Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,20 @@ model_name = "deepset/roberta-base-squad2"
|
|
| 4 |
|
| 5 |
# a) Get predictions
|
| 6 |
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
QA_input = {
|
| 8 |
'question': 'Why is model conversion important?',
|
| 9 |
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
|
@@ -12,4 +26,4 @@ res = nlp(QA_input)
|
|
| 12 |
|
| 13 |
# b) Load model & tokenizer
|
| 14 |
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 15 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
|
| 4 |
|
| 5 |
# a) Get predictions
|
| 6 |
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
| 7 |
+
def main():
|
| 8 |
+
st.title("English to German")
|
| 9 |
+
|
| 10 |
+
with st.form("text_field"):
|
| 11 |
+
text = st.text_area('enter some english word:')
|
| 12 |
+
# clicked==True only when the button is clicked
|
| 13 |
+
clicked = st.form_submit_button("Submit")
|
| 14 |
+
if clicked:
|
| 15 |
+
results = classifier([text])
|
| 16 |
+
st.json(results)
|
| 17 |
+
|
| 18 |
+
if __name__ == "__main__":
|
| 19 |
+
main()
|
| 20 |
+
|
| 21 |
QA_input = {
|
| 22 |
'question': 'Why is model conversion important?',
|
| 23 |
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
|
|
|
| 26 |
|
| 27 |
# b) Load model & tokenizer
|
| 28 |
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 29 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|