Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,17 +5,17 @@ from transformers import pipeline
|
|
| 5 |
qa = pipeline('question-answering')
|
| 6 |
|
| 7 |
# criando a função para a interface
|
| 8 |
-
def answer_question(
|
| 9 |
-
resposta = qa(context=
|
| 10 |
return resposta['answer']
|
| 11 |
|
| 12 |
iface = gr.Interface(
|
| 13 |
fn=answer_question,
|
| 14 |
inputs=[
|
| 15 |
-
gr.Textbox(type="text", label="
|
| 16 |
-
gr.Textbox(type="text", label="
|
| 17 |
],
|
| 18 |
-
outputs=gr.Textbox(type="text", label="
|
| 19 |
)
|
| 20 |
|
| 21 |
iface.launch()
|
|
|
|
| 5 |
qa = pipeline('question-answering')
|
| 6 |
|
| 7 |
# criando a função para a interface
|
| 8 |
+
def answer_question(contexto, pergunta):
|
| 9 |
+
resposta = qa(context=contexto, question=pergunta)
|
| 10 |
return resposta['answer']
|
| 11 |
|
| 12 |
iface = gr.Interface(
|
| 13 |
fn=answer_question,
|
| 14 |
inputs=[
|
| 15 |
+
gr.Textbox(type="text", label="Contexto"),
|
| 16 |
+
gr.Textbox(type="text", label="Pergunta")
|
| 17 |
],
|
| 18 |
+
outputs=gr.Textbox(type="text", label="Resposta")
|
| 19 |
)
|
| 20 |
|
| 21 |
iface.launch()
|