Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline
|
4 |
|
@@ -19,7 +18,6 @@ def parse_output(output_json): # list of list of dicts
|
|
19 |
list_pred.append((label, score))
|
20 |
return list_pred
|
21 |
|
22 |
-
|
23 |
def get_prediction(model_id):
|
24 |
|
25 |
classifier = pipeline("text-classification", model=model_id, return_all_scores=True)
|
@@ -39,7 +37,6 @@ with app:
|
|
39 |
""")
|
40 |
with gr.Row():
|
41 |
inp_1= gr.Textbox(label="Type text here.",placeholder="The customer service was satisfactory.")
|
42 |
-
|
43 |
gr.Markdown(
|
44 |
"""
|
45 |
**Model Predictions**
|
@@ -77,7 +74,6 @@ with app:
|
|
77 |
""")
|
78 |
btn6 = gr.Button("Predict - Model 6")
|
79 |
|
80 |
-
|
81 |
with gr.Column():
|
82 |
out_1 = gr.Textbox(label="Predictions for Model 1")
|
83 |
out_2 = gr.Textbox(label="Predictions for Model 2")
|
@@ -92,4 +88,5 @@ with app:
|
|
92 |
btn4.click(fn=get_prediction(model_id_4), inputs=inp_1, outputs=out_4)
|
93 |
btn5.click(fn=get_prediction(model_id_5), inputs=inp_1, outputs=out_5)
|
94 |
btn6.click(fn=get_prediction(model_id_6), inputs=inp_1, outputs=out_6)
|
|
|
95 |
app.launch()
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
|
|
18 |
list_pred.append((label, score))
|
19 |
return list_pred
|
20 |
|
|
|
21 |
def get_prediction(model_id):
|
22 |
|
23 |
classifier = pipeline("text-classification", model=model_id, return_all_scores=True)
|
|
|
37 |
""")
|
38 |
with gr.Row():
|
39 |
inp_1= gr.Textbox(label="Type text here.",placeholder="The customer service was satisfactory.")
|
|
|
40 |
gr.Markdown(
|
41 |
"""
|
42 |
**Model Predictions**
|
|
|
74 |
""")
|
75 |
btn6 = gr.Button("Predict - Model 6")
|
76 |
|
|
|
77 |
with gr.Column():
|
78 |
out_1 = gr.Textbox(label="Predictions for Model 1")
|
79 |
out_2 = gr.Textbox(label="Predictions for Model 2")
|
|
|
88 |
btn4.click(fn=get_prediction(model_id_4), inputs=inp_1, outputs=out_4)
|
89 |
btn5.click(fn=get_prediction(model_id_5), inputs=inp_1, outputs=out_5)
|
90 |
btn6.click(fn=get_prediction(model_id_6), inputs=inp_1, outputs=out_6)
|
91 |
+
|
92 |
app.launch()
|