igoracmorais commited on
Commit
3fdeead
·
verified ·
1 Parent(s): 7feda76

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +21 -0
  2. requirements.txt +1 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # criando o pipeline para a QA
5
+ qa = pipeline('question-answering')
6
+
7
+ # criando a função para a interface
8
+ def answer_question(context, question):
9
+ resposta = qa(context=context, question=question)
10
+ return resposta['answer']
11
+
12
+ iface = gr.Interface(
13
+ fn=answer_question,
14
+ inputs=[
15
+ gr.Textbox(type="text", label="Context"),
16
+ gr.Textbox(type="text", label="Question")
17
+ ],
18
+ outputs=gr.Textbox(type="text", label="Answer")
19
+ )
20
+
21
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio==3.39.0