Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,14 @@
|
|
1 |
-
|
2 |
-
#Import libraries
|
3 |
import gradio as gr
|
4 |
|
5 |
-
|
6 |
# Load the question-answering pipeline using the deepset/roberta-base-squad2 model
|
7 |
qa_model = pipeline("question-answering", model="deepset/roberta-base-squad2")
|
8 |
|
9 |
-
|
10 |
-
|
11 |
# Define a function to get the model's response
|
12 |
def get_response(context, question):
|
13 |
answer = qa_model(question=question, context=context)["answer"]
|
14 |
return answer
|
15 |
|
16 |
-
|
17 |
-
|
18 |
# Define the interface components
|
19 |
context_textbox = gr.Textbox(lines=10, label="Context")
|
20 |
question_textbox = gr.Textbox(label="Question")
|
@@ -30,3 +24,4 @@ interface = gr.Interface(
|
|
30 |
|
31 |
# Launch the interface
|
32 |
interface.launch(share=True)
|
|
|
|
1 |
+
from transformers import pipeline
|
|
|
2 |
import gradio as gr
|
3 |
|
|
|
4 |
# Load the question-answering pipeline using the deepset/roberta-base-squad2 model
|
5 |
qa_model = pipeline("question-answering", model="deepset/roberta-base-squad2")
|
6 |
|
|
|
|
|
7 |
# Define a function to get the model's response
|
8 |
def get_response(context, question):
|
9 |
answer = qa_model(question=question, context=context)["answer"]
|
10 |
return answer
|
11 |
|
|
|
|
|
12 |
# Define the interface components
|
13 |
context_textbox = gr.Textbox(lines=10, label="Context")
|
14 |
question_textbox = gr.Textbox(label="Question")
|
|
|
24 |
|
25 |
# Launch the interface
|
26 |
interface.launch(share=True)
|
27 |
+
|