CK42 commited on
Commit
9fed4f1
1 Parent(s): 222e60b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -2,8 +2,6 @@
2
  from os import O_ACCMODE
3
  import gradio as gr
4
  from transformers import pipeline
5
- # from huggingface_hub import HfApi, hf_hub_download
6
- # from huggingface_hub.repocard import metadata_load
7
 
8
  app = gr.Blocks()
9
 
@@ -13,7 +11,7 @@ model_id_3 = "distilbert-base-uncased-finetuned-sst-2-english"
13
  model_id_4 = "lordtt13/emo-mobilebert"
14
  model_id_5 = "juliensimon/reviews-sentiment-analysis"
15
 
16
- def parse_output(output_json): # list of list of dicts
17
  list_pred=[]
18
  for i in range(len(output_json[0])):
19
  label = output_json[0][i]['label']
@@ -75,11 +73,11 @@ with app:
75
  btn5 = gr.Button("Predict - Model 5")
76
 
77
  with gr.Column():
78
- out_1 = gr.Textbox(label="Predictions for Model 1", lines=5)
79
- out_2 = gr.Textbox(label="Predictions for Model 2", lines=5)
80
- out_3 = gr.Textbox(label="Predictions for Model 3", lines=5)
81
- out_4 = gr.Textbox(label="Predictions for Model 4", lines=5)
82
- out_5 = gr.Textbox(label="Predictions for Model 5", lines=5)
83
 
84
  btn1.click(fn=get_prediction(model_id_1), inputs=inp_1, outputs=out_1)
85
  btn2.click(fn=get_prediction(model_id_2), inputs=inp_1, outputs=out_2)
 
2
  from os import O_ACCMODE
3
  import gradio as gr
4
  from transformers import pipeline
 
 
5
 
6
  app = gr.Blocks()
7
 
 
11
  model_id_4 = "lordtt13/emo-mobilebert"
12
  model_id_5 = "juliensimon/reviews-sentiment-analysis"
13
 
14
+ def parse_output(output_json):
15
  list_pred=[]
16
  for i in range(len(output_json[0])):
17
  label = output_json[0][i]['label']
 
73
  btn5 = gr.Button("Predict - Model 5")
74
 
75
  with gr.Column():
76
+ out_1 = gr.Textbox(label="Predictions for Model 1")
77
+ out_2 = gr.Textbox(label="Predictions for Model 2")
78
+ out_3 = gr.Textbox(label="Predictions for Model 3")
79
+ out_4 = gr.Textbox(label="Predictions for Model 4")
80
+ out_5 = gr.Textbox(label="Predictions for Model 5")
81
 
82
  btn1.click(fn=get_prediction(model_id_1), inputs=inp_1, outputs=out_1)
83
  btn2.click(fn=get_prediction(model_id_2), inputs=inp_1, outputs=out_2)