Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# Load your model
|
| 4 |
+
model = gr.load("models/DevBM/t5-large-squad")
|
| 5 |
+
|
| 6 |
+
# Define the input and output interfaces
|
| 7 |
+
inputs = gr.inputs.Textbox(label="Question")
|
| 8 |
+
output = gr.outputs.Textbox(label="Answer")
|
| 9 |
+
|
| 10 |
+
# Define examples that users can select from
|
| 11 |
+
examples = [
|
| 12 |
+
["What is the capital of France?", ""],
|
| 13 |
+
["Who wrote the Harry Potter series?", ""],
|
| 14 |
+
["What is the largest planet in our solar system?", ""]
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
# Launch the Gradio interface with examples
|
| 18 |
+
gr.Interface(fn=model.predict, inputs=inputs, outputs=output, examples=examples).launch()
|