ayoubkirouane commited on
Commit
66e303c
1 Parent(s): 058319a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the question answering pipeline with your fine-tuned model
5
+ qa_pipe = pipeline("question-answering", model="ayoubkirouane/QA-DistilBERT-base-squad")
6
+
7
+ def answer_question(context, question):
8
+ result = qa_pipe(question=question, context=context)
9
+ return result['answer']
10
+
11
+ # Create a Gradio interface
12
+ iface = gr.Interface(
13
+ fn=answer_question,
14
+ inputs=["text", "text"],
15
+ outputs="text",
16
+ title="Question Answering with QA-DistilBERT-base-squad",
17
+ description="Provide a context and a question to get an answer.",
18
+ )
19
+
20
+ # Launch the Gradio app
21
+ iface.launch(debug=True)