Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load your model
|
| 5 |
+
qa_pipeline = pipeline("question-answering", model="Austinsz-Warehouse/test2")
|
| 6 |
+
|
| 7 |
+
def answer_question(context, question):
|
| 8 |
+
result = qa_pipeline(question=question, context=context)
|
| 9 |
+
return result['answer']
|
| 10 |
+
|
| 11 |
+
# Gradio interface
|
| 12 |
+
gr.Interface(
|
| 13 |
+
fn=answer_question,
|
| 14 |
+
inputs=["text", "text"],
|
| 15 |
+
outputs="text",
|
| 16 |
+
title="Question Answering with test2",
|
| 17 |
+
description="Ask questions based on a given context using Austinsz-Warehouse/test2"
|
| 18 |
+
).launch()
|