subrota2k2 commited on
Commit
e8d1668
1 Parent(s): 81cad45

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -1,15 +1,10 @@
1
- from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline
2
  import gradio as grad
3
- import ast
 
4
 
5
- mdl_name = "distilbert-base-cased-distilled-squad"
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
- di=ast.literal_eval(text)
13
- response = my_pipeline(di)
14
  return response
15
- grad.Interface(answer_question, inputs=["text","text"], outputs="text").launch()
 
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()