DevBM commited on
Commit
c1b9e99
·
verified ·
1 Parent(s): b338e3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,7 +1,14 @@
1
  import gradio as gr
 
2
 
3
  # Load your model
4
- model = gr.Interface.load("models/DevBM/t5-large-squad")
 
 
 
 
 
 
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
- model.launch(inputs=inputs, outputs=outputs, examples=examples)
 
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()