pere commited on
Commit
be5cb81
·
1 Parent(s): 87a44f6
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -4,7 +4,7 @@ from transformers import T5ForConditionalGeneration, T5TokenizerFast, T5Config
4
 
5
 
6
  if 'textbox' not in st.session_state:
7
- st.session_state['textbox'] = "We are not using punctation or capital letters when we are speaking. Actually we hardly even use pauses between words. Still we are able to make sense out of the text. This demo shows that a T5-model is able to reconstruct the sentences, even if these parts of the text is removed. Try removing spaces, capital letters and puctation from this text, and then see if the model can recpnstruct it. Did it work?"
8
 
9
  @st.cache(allow_output_mutation=True, suppress_st_warning=True)
10
  def load_model():
@@ -35,18 +35,16 @@ def sidebar_callback():
35
  st.session_state['textbox'] = st.session_state['prefilled']
36
 
37
  st.title("DeUnCaser")
38
- st.sidebar.write("This web app adds spaces, punctation and capitalisation back into the text.")
39
- st.sidebar.write("You can use the examples below, but too really test the effect of the model: Write or copy text from the Internet, and then manually remove spaces, puctation, cases etc. Try to restore the text.")
40
  option = st.sidebar.selectbox(
41
  "Examples:",
42
- ("This model is crated by Per Egil Kummervold. This is not a common name in English. Do you think the model will understand that it is a name?","Some Norwegian text: Vi bruker ikke tegnsetting eller store bokstaver når vi prater. Vi slår også sammen ord, og i praksis er dermed heller ikke mellomrom meningsbærende. Prøv å fjerne tegnsetting, store bokstaver og mellomrom fra dette avsnittet. Se om den nye North-T5-modellen greier å sette sammen til et nytt meningsbærende avsnitt.","areyouabletoreadthistextwillthemodelbeableto"),key='prefilled',on_change=sidebar_callback)
43
 
44
  placeholder = st.empty()
45
  st.sidebar.write("\nText Tools:")
46
  st.sidebar.button('Remove Punctation', on_click=unpunct)
47
  st.sidebar.button('Remove Casing', on_click=uncase)
48
- st.sidebar.button('Remove Spaces', on_click=unspace)
49
-
50
  with placeholder:
51
  text = st.text_area(f"Input text",max_chars=1000,height=140,key="textbox")
52
 
 
4
 
5
 
6
  if 'textbox' not in st.session_state:
7
+ st.session_state['textbox'] = "We are not using punctation or capital letters when we are speaking. Still we are able to make sense out of the text. This demo shows that a T5-model is able to reconstruct the sentences, even if these parts of the text is removed. Try removing capital letters and punctation from this text, and then see if the model can reconstruct it. Did it work?"
8
 
9
  @st.cache(allow_output_mutation=True, suppress_st_warning=True)
10
  def load_model():
 
35
  st.session_state['textbox'] = st.session_state['prefilled']
36
 
37
  st.title("DeUnCaser")
38
+ st.sidebar.write("This web app adds punctation and capitalisation back into the text.")
39
+ st.sidebar.write("You can use the examples below, but too really test the effect of the model: Write or copy text from the Internet, and then manually remove punctation and casing etc. Try to restore the text.")
40
  option = st.sidebar.selectbox(
41
  "Examples:",
42
+ ("This model is crated by Per Egil Kummervold. This is not a common name in English. Do you think the model will understand that it is a name?","Some Norwegian text: Vi bruker ikke tegnsetting eller store bokstaver når vi prater. Prøv å fjerne tegnsetting og store bokstaver. Se om denne T5-modellen greier å sette sammen til et nytt meningsbærende avsnitt."),key='prefilled',on_change=sidebar_callback)
43
 
44
  placeholder = st.empty()
45
  st.sidebar.write("\nText Tools:")
46
  st.sidebar.button('Remove Punctation', on_click=unpunct)
47
  st.sidebar.button('Remove Casing', on_click=uncase)
 
 
48
  with placeholder:
49
  text = st.text_area(f"Input text",max_chars=1000,height=140,key="textbox")
50