Spaces:
Runtime error
Runtime error
subrota2k2
commited on
Commit
•
e8d1668
1
Parent(s):
81cad45
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,10 @@
|
|
1 |
-
from transformers import
|
2 |
import gradio as grad
|
3 |
-
|
|
|
4 |
|
5 |
-
|
6 |
-
my_pipeline = pipeline('question-answering', model=mdl_name, tokenizer=mdl_name)
|
7 |
-
|
8 |
-
|
9 |
-
def answer_question(question,context):
|
10 |
-
text= "{"+"'question': '"+question+"','context': '"+context+"'}"
|
11 |
|
12 |
-
|
13 |
-
response = my_pipeline(di)
|
14 |
return response
|
15 |
-
grad.Interface(
|
|
|
1 |
+
from transformers import pipeline
|
2 |
import gradio as grad
|
3 |
+
mdl_name = "Helsinki-NLP/opus-mt-en-de"
|
4 |
+
opus_translator = pipeline("translation", model=mdl_name)
|
5 |
|
6 |
+
def translate(text):
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
response = opus_translator(text)
|
|
|
9 |
return response
|
10 |
+
grad.Interface(translate, inputs=["text",], outputs="text").launch()
|