Framos888 commited on
Commit
a36358f
verified
1 Parent(s): 3e94db7

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ qa = pipeline("question-answering", model="distilbert-base-uncased-distilled-squad")
5
+
6
+ def responder(contexto, pregunta):
7
+ respuesta = qa(question=pregunta, context=contexto)
8
+ return respuesta["answer"]
9
+
10
+ app = gr.Interface(
11
+ fn=responder,
12
+ inputs=[gr.Textbox(label="Contexto"), gr.Textbox(label="Pregunta")],
13
+ outputs="text"
14
+ )
15
+
16
+ app.launch()