Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,7 @@
|
|
| 1 |
-
from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
|
| 2 |
import streamlit as st
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
# a) Get predictions
|
| 7 |
-
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
| 8 |
def main():
|
| 9 |
st.title("English to German")
|
| 10 |
|
|
@@ -17,14 +14,4 @@ def main():
|
|
| 17 |
st.json(results)
|
| 18 |
|
| 19 |
if __name__ == "__main__":
|
| 20 |
-
main()
|
| 21 |
-
|
| 22 |
-
QA_input = {
|
| 23 |
-
'question': 'Why is model conversion important?',
|
| 24 |
-
'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
| 25 |
-
}
|
| 26 |
-
res = nlp(QA_input)
|
| 27 |
-
|
| 28 |
-
# b) Load model & tokenizer
|
| 29 |
-
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 30 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
classifier = pipeline("translation", model="t5-small")
|
|
|
|
|
|
|
|
|
|
| 5 |
def main():
|
| 6 |
st.title("English to German")
|
| 7 |
|
|
|
|
| 14 |
st.json(results)
|
| 15 |
|
| 16 |
if __name__ == "__main__":
|
| 17 |
+
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|