Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
question_answerer = pipeline("question-answering")
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def main(context, question):
|
| 8 |
+
answer = question_answerer(
|
| 9 |
+
question=question,
|
| 10 |
+
context=context,
|
| 11 |
+
)
|
| 12 |
+
return answer
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
demo = gr.Interface(
|
| 16 |
+
fn=main,
|
| 17 |
+
inputs=["text", "text"],
|
| 18 |
+
outputs="text",
|
| 19 |
+
title="Question Answering"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
demo.launch(
|
| 23 |
+
inbrowser=True,
|
| 24 |
+
show_error=True,
|
| 25 |
+
show_tips=True,
|
| 26 |
+
show_api=False)
|