Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,16 +1,14 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from transformers import
|
| 3 |
|
| 4 |
st.title("SpellCorrectorT5")
|
| 5 |
st.markdown('SpellCorrectorT5 is a fine-tuned version of **pre-trained t5-small model** modelled on randomly selected 50000 sentences modified by [imputing random noises/errors](./random_noiser.py) and trained using transformers. It not only looks for _spelling errors but also looks for the semantics_ in the sentence and suggest other possible words for the incorrect word.')
|
| 6 |
-
ttokenizer = AutoTokenizer.from_pretrained("
|
| 7 |
-
tmodel =
|
| 8 |
-
|
| 9 |
form = st.form("T5-form")
|
| 10 |
|
| 11 |
examples = ["I will return it to yu once it is donr",
|
| 12 |
-
"Iu is going to rain"
|
| 13 |
-
"Feel free to raach out to me",
|
| 14 |
"Wheir do you live?",
|
| 15 |
"It wis great mieting with you all"]
|
| 16 |
|
|
@@ -21,16 +19,16 @@ input_text = form.text_input(label='Enter your own sentence', value=input_text)
|
|
| 21 |
submit = form.form_submit_button("Submit")
|
| 22 |
|
| 23 |
if submit:
|
| 24 |
-
input_ids = ttokenizer.encode(
|
| 25 |
|
| 26 |
# generate text until the output length (which includes the context length) reaches 50
|
| 27 |
outputs = tmodel.generate(
|
| 28 |
input_ids,
|
| 29 |
do_sample=True,
|
| 30 |
max_length=50,
|
| 31 |
-
top_p=0.
|
| 32 |
-
top_k=
|
| 33 |
-
num_return_sequences=
|
| 34 |
)
|
| 35 |
|
| 36 |
st.subheader("Most probable: ")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
| 3 |
|
| 4 |
st.title("SpellCorrectorT5")
|
| 5 |
st.markdown('SpellCorrectorT5 is a fine-tuned version of **pre-trained t5-small model** modelled on randomly selected 50000 sentences modified by [imputing random noises/errors](./random_noiser.py) and trained using transformers. It not only looks for _spelling errors but also looks for the semantics_ in the sentence and suggest other possible words for the incorrect word.')
|
| 6 |
+
ttokenizer = AutoTokenizer.from_pretrained("vishnun/tinygram")
|
| 7 |
+
tmodel = AutoModelForSeq2SeqLM.from_pretrained("vishnun/tinygram")
|
|
|
|
| 8 |
form = st.form("T5-form")
|
| 9 |
|
| 10 |
examples = ["I will return it to yu once it is donr",
|
| 11 |
+
"Iu is going to rain",,
|
|
|
|
| 12 |
"Wheir do you live?",
|
| 13 |
"It wis great mieting with you all"]
|
| 14 |
|
|
|
|
| 19 |
submit = form.form_submit_button("Submit")
|
| 20 |
|
| 21 |
if submit:
|
| 22 |
+
input_ids = ttokenizer.encode(input_text, return_tensors='pt')
|
| 23 |
|
| 24 |
# generate text until the output length (which includes the context length) reaches 50
|
| 25 |
outputs = tmodel.generate(
|
| 26 |
input_ids,
|
| 27 |
do_sample=True,
|
| 28 |
max_length=50,
|
| 29 |
+
top_p=0.999,
|
| 30 |
+
top_k=45,
|
| 31 |
+
num_return_sequences=2
|
| 32 |
)
|
| 33 |
|
| 34 |
st.subheader("Most probable: ")
|