Update app.py
Browse files
app.py
CHANGED
|
@@ -35,7 +35,7 @@ def qa_paraphrase(text_input, question):
|
|
| 35 |
batch = tokenizer3([sentence],truncation=True,padding='longest',max_length=60, return_tensors="pt").to(torch_device)
|
| 36 |
translated = model3.generate(**batch,max_length=60,num_beams=10, num_return_sequences=1, temperature=1.5)
|
| 37 |
paraphrase = tokenizer3.batch_decode(translated, skip_special_tokens=True)[0]
|
| 38 |
-
return
|
| 39 |
|
| 40 |
|
| 41 |
iface = gr.Interface(
|
|
@@ -44,10 +44,7 @@ iface = gr.Interface(
|
|
| 44 |
gr.inputs.Textbox(label="Text Input"),
|
| 45 |
gr.inputs.Textbox(label="Question")
|
| 46 |
],
|
| 47 |
-
outputs=
|
| 48 |
-
"Answer": gr.outputs.Textbox(label="Answer"),
|
| 49 |
-
"Paraphrased Sentence": gr.outputs.Textbox(label="Paraphrased Sentence")
|
| 50 |
-
},
|
| 51 |
title="Question Answering and Paraphrasing",
|
| 52 |
description="Answer a given question from a given text and paraphrase the sentence containing the answer."
|
| 53 |
)
|
|
|
|
| 35 |
batch = tokenizer3([sentence],truncation=True,padding='longest',max_length=60, return_tensors="pt").to(torch_device)
|
| 36 |
translated = model3.generate(**batch,max_length=60,num_beams=10, num_return_sequences=1, temperature=1.5)
|
| 37 |
paraphrase = tokenizer3.batch_decode(translated, skip_special_tokens=True)[0]
|
| 38 |
+
return f"Answer: {answer}\nParaphrased Sentence: {paraphrase}"
|
| 39 |
|
| 40 |
|
| 41 |
iface = gr.Interface(
|
|
|
|
| 44 |
gr.inputs.Textbox(label="Text Input"),
|
| 45 |
gr.inputs.Textbox(label="Question")
|
| 46 |
],
|
| 47 |
+
outputs=gr.outputs.Textbox(label="Output"),
|
|
|
|
|
|
|
|
|
|
| 48 |
title="Question Answering and Paraphrasing",
|
| 49 |
description="Answer a given question from a given text and paraphrase the sentence containing the answer."
|
| 50 |
)
|