Spaces:
Build error
Build error
Commit ·
441ff1d
1
Parent(s): a1ff158
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,33 +15,15 @@ def model_performance_UQS(model_checkpoint, context, question):
|
|
| 15 |
|
| 16 |
m1 = gr.Interface.load("huggingface/amitjohn007/albert-finetuned-squad")
|
| 17 |
m2 = gr.Interface.load("huggingface/amitjohn007/bert-finetuned-squad")
|
| 18 |
-
m3 = gr.Interface.load("huggingface/amitjohn007/roberta-base-finetuned-squad")
|
| 19 |
-
m4 = gr.Interface.load("huggingface/amitjohn007/xlm-roberta-base-finetuned-squad")
|
| 20 |
-
m5 = gr.Interface.load("huggingface/amitjohn007/simplebert-base-finetuned-squad")
|
| 21 |
-
m6 = gr.Interface.load("huggingface/amitjohn007/electra-finetuned-squad")
|
| 22 |
-
m7 = gr.Interface.load("huggingface/amitjohn007/second-mobil-bert-finetuned-squad")
|
| 23 |
-
m8 = gr.Interface.load("huggingface/amitjohn007/mpnet-finetuned")
|
| 24 |
|
| 25 |
def predict(model_choice,context,question):
|
| 26 |
if model_choice=="m1":
|
| 27 |
-
return model_performance_UQS(model_checkpoint=
|
| 28 |
-
elif model_choice==m2:
|
| 29 |
-
return model_performance_UQS(model_checkpoint=m2,context=context,question=question)
|
| 30 |
-
elif model_choice=="m3":
|
| 31 |
-
return model_performance_UQS(model_checkpoint=m3,context=context,question=question)
|
| 32 |
-
elif model_choice=="m4":
|
| 33 |
-
return model_performance_UQS(model_checkpoint=m4,context=context,question=question)
|
| 34 |
-
elif model_choice=="m5":
|
| 35 |
-
return model_performance_UQS(model_checkpoint=m5,context=context,question=question)
|
| 36 |
-
elif model_choice=="m6":
|
| 37 |
-
return model_performance_UQS(model_checkpoint=m6,context=context,question=question)
|
| 38 |
-
elif model_choice=="m7":
|
| 39 |
-
return model_performance_UQS(model_checkpoint=m7,context=context,question=question)
|
| 40 |
-
elif model_choice=="m8":
|
| 41 |
-
return model_performance_UQS(model_checkpoint=m8,context=context,question=question)
|
| 42 |
|
| 43 |
Interface=gr.Interface(
|
| 44 |
fn = predict,
|
| 45 |
-
inputs = [gr.inputs.Dropdown(["m1","m2"
|
| 46 |
outputs = [gr.outputs.Textbox(label="Answer"), gr.outputs.Textbox(label="Score")]
|
| 47 |
).launch(debug=True)
|
|
|
|
| 15 |
|
| 16 |
m1 = gr.Interface.load("huggingface/amitjohn007/albert-finetuned-squad")
|
| 17 |
m2 = gr.Interface.load("huggingface/amitjohn007/bert-finetuned-squad")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
def predict(model_choice,context,question):
|
| 20 |
if model_choice=="m1":
|
| 21 |
+
return model_performance_UQS(model_checkpoint=m1,context=context,question=question)
|
| 22 |
+
elif model_choice=="m2":
|
| 23 |
+
return model_performance_UQS(model_checkpoint=m2,context=context,question=question)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
Interface=gr.Interface(
|
| 26 |
fn = predict,
|
| 27 |
+
inputs = [gr.inputs.Dropdown(["m1","m2"],"value"),gr.inputs.Textbox(lines=7, default=context, label="Context Paragraph"), gr.inputs.Textbox(lines=2, default=question, label="Question")],
|
| 28 |
outputs = [gr.outputs.Textbox(label="Answer"), gr.outputs.Textbox(label="Score")]
|
| 29 |
).launch(debug=True)
|