Update app.py
Browse files
app.py
CHANGED
@@ -6,9 +6,6 @@ from transformers import T5ForConditionalGeneration, T5TokenizerFast, T5Config
|
|
6 |
def load_model():
|
7 |
model_name = "north/demo-deuncaser-base"
|
8 |
config = T5Config.from_pretrained(model_name)
|
9 |
-
#Debug
|
10 |
-
#st.text(config)
|
11 |
-
#st.text("north/demo-nynorsk-base")
|
12 |
model = T5ForConditionalGeneration.from_pretrained(model_name,config=config)
|
13 |
tokenizer = T5TokenizerFast.from_pretrained(model_name)
|
14 |
return (model, tokenizer)
|
@@ -26,19 +23,13 @@ def spaces():
|
|
26 |
|
27 |
st.title("DeUnCaser")
|
28 |
|
29 |
-
|
30 |
-
|
31 |
|
32 |
optionx = st.sidebar.selectbox(
|
33 |
"Examples:",
|
34 |
("tirsdag var travel for ukrainas president volodymyr zelenskyj på morgenen tok han imot polens statsminister mateusz morawiecki","tirsdagvartravelforukrainaspresidentvolodymyrzelenskyjpåkveldentokhanimotpolensstatsministermateuszmorawiecki","deterikkelettåholderedepåstoreogsmåbokstavermanmåforeksempelhuskestorforbokstavnårmanskriveromkrimhalvøyamenkunbrukelitenforbokstavnårmanhenvisertilenkrimroman","detteerenlitendemosomerlagetavperegilkummervoldhanerenforskersomtidligerejobbetvednasjonalbiblioteketimoirana"))
|
35 |
|
36 |
-
|
37 |
-
st.sidebar.write("This web app adds spaces, punctation and capitalisation back into the text.")
|
38 |
-
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 use the buttons to remove spaces, puctation, cases etc. Try to restore the text.")
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
col1, col2, col3 = st.columns([1,1,1])
|
43 |
with col1:
|
44 |
st.button('Remove Casing')
|
@@ -47,7 +38,7 @@ with col2:
|
|
47 |
with col3:
|
48 |
st.button('Remove Spaces')
|
49 |
|
50 |
-
text = st.text_area(f"",max_chars=1000, value= "")
|
51 |
|
52 |
run = st.button('Run DeUnCaser')
|
53 |
|
|
|
6 |
def load_model():
|
7 |
model_name = "north/demo-deuncaser-base"
|
8 |
config = T5Config.from_pretrained(model_name)
|
|
|
|
|
|
|
9 |
model = T5ForConditionalGeneration.from_pretrained(model_name,config=config)
|
10 |
tokenizer = T5TokenizerFast.from_pretrained(model_name)
|
11 |
return (model, tokenizer)
|
|
|
23 |
|
24 |
st.title("DeUnCaser")
|
25 |
|
26 |
+
st.sidebar.write("This web app adds spaces, punctation and capitalisation back into the text.")
|
27 |
+
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 use the buttons to remove spaces, puctation, cases etc. Try to restore the text.")
|
28 |
|
29 |
optionx = st.sidebar.selectbox(
|
30 |
"Examples:",
|
31 |
("tirsdag var travel for ukrainas president volodymyr zelenskyj på morgenen tok han imot polens statsminister mateusz morawiecki","tirsdagvartravelforukrainaspresidentvolodymyrzelenskyjpåkveldentokhanimotpolensstatsministermateuszmorawiecki","deterikkelettåholderedepåstoreogsmåbokstavermanmåforeksempelhuskestorforbokstavnårmanskriveromkrimhalvøyamenkunbrukelitenforbokstavnårmanhenvisertilenkrimroman","detteerenlitendemosomerlagetavperegilkummervoldhanerenforskersomtidligerejobbetvednasjonalbiblioteketimoirana"))
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
col1, col2, col3 = st.columns([1,1,1])
|
34 |
with col1:
|
35 |
st.button('Remove Casing')
|
|
|
38 |
with col3:
|
39 |
st.button('Remove Spaces')
|
40 |
|
41 |
+
text = st.text_area(f"hvemskulletroatnoenvirkeligkallerungensinperegilkummervold",max_chars=1000, value= "")
|
42 |
|
43 |
run = st.button('Run DeUnCaser')
|
44 |
|