Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,14 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
# Load your model
|
4 |
-
model =
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Define the input and output interfaces
|
7 |
inputs = gr.Textbox(label="Question")
|
@@ -15,4 +22,4 @@ examples = [
|
|
15 |
]
|
16 |
|
17 |
# Launch the Gradio interface with examples
|
18 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
# Load your model
|
5 |
+
model = pipeline("question-answering", model="DevBM/t5-large-squad")
|
6 |
+
|
7 |
+
# Define the prediction function
|
8 |
+
def predict(question):
|
9 |
+
context = "Your context here" # You need to provide the context for the question
|
10 |
+
result = model(question=question, context=context)
|
11 |
+
return result['answer']
|
12 |
|
13 |
# Define the input and output interfaces
|
14 |
inputs = gr.Textbox(label="Question")
|
|
|
22 |
]
|
23 |
|
24 |
# Launch the Gradio interface with examples
|
25 |
+
gr.Interface(fn=predict, inputs=inputs, outputs=outputs, examples=examples).launch()
|