Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,23 +3,6 @@ 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")
|
15 |
-
outputs = gr.Textbox(label="Answer")
|
16 |
-
|
17 |
-
# Define examples that users can select from
|
18 |
-
examples = [
|
19 |
-
["What is the capital of France?", ""],
|
20 |
-
["Who wrote the Harry Potter series?", ""],
|
21 |
-
["What is the largest planet in our solar system?", ""]
|
22 |
-
]
|
23 |
-
|
24 |
# Launch the Gradio interface with examples
|
25 |
-
gr.Interface(fn=predict, inputs=inputs, outputs=outputs, examples=examples).launch()
|
|
|
|
3 |
|
4 |
# Load your model
|
5 |
model = pipeline("question-answering", model="DevBM/t5-large-squad")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
# Launch the Gradio interface with examples
|
7 |
+
# gr.Interface(fn=predict, inputs=inputs, outputs=outputs, examples=examples).launch()
|
8 |
+
gr.launch()
|