Austinsz-Warehouse commited on
Commit
b6bda11
·
verified ·
1 Parent(s): e097524

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
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()