CK42 commited on
Commit
badd498
1 Parent(s): 0997d43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -1,6 +1,4 @@
1
 
2
- # https://huggingface.co/spaces/CK42/sentiment-model-comparison/blob/main/app.py
3
-
4
  # import sklearn
5
  from os import O_ACCMODE
6
  import gradio as gr
@@ -43,8 +41,6 @@ def get_metadata(model_id):
43
  return metadata
44
  except requests.exceptions.HTTPError:
45
  return None
46
-
47
- # classifier = pipeline("text-classification", model="juliensimon/distilbert-amazon-shoe-reviews")
48
 
49
  def predict(review, model_id):
50
  classifier = pipeline("text-classification", model=model_id)
@@ -66,11 +62,10 @@ with app:
66
  inp_1= gr.Textbox(label="Type text here.",placeholder="The customer service was satisfactory.")
67
  out_2 = gr.Textbox(label="Prediction")
68
 
69
-
70
- # gr.Markdown(
71
- # """
72
- # Model Predictions
73
- # """)
74
  with gr.Row():
75
  model1_input = gr.Textbox(label="Model 1")
76
  with gr.Row():
@@ -83,7 +78,7 @@ with app:
83
  model2_input = gr.Textbox(label="Model 2")
84
  with gr.Row():
85
  btn = gr.Button("Prediction for Model 2")
86
- btn.click(fn=predict(model_id_2), inputs=inp_1, outputs=out_2)
87
 
88
 
89
  # app_button.click(load_agent, inputs=[model1_input, model2_input], outputs=[model1_name, model1_score_output, model2_name, model2_score_output])
 
1
 
 
 
2
  # import sklearn
3
  from os import O_ACCMODE
4
  import gradio as gr
 
41
  return metadata
42
  except requests.exceptions.HTTPError:
43
  return None
 
 
44
 
45
  def predict(review, model_id):
46
  classifier = pipeline("text-classification", model=model_id)
 
62
  inp_1= gr.Textbox(label="Type text here.",placeholder="The customer service was satisfactory.")
63
  out_2 = gr.Textbox(label="Prediction")
64
 
65
+ gr.Markdown(
66
+ """
67
+ Model Predictions
68
+ """)
 
69
  with gr.Row():
70
  model1_input = gr.Textbox(label="Model 1")
71
  with gr.Row():
 
78
  model2_input = gr.Textbox(label="Model 2")
79
  with gr.Row():
80
  btn = gr.Button("Prediction for Model 2")
81
+ btn.click(fn=load_agent(model_id_2), inputs=inp_1, outputs=out_2)
82
 
83
 
84
  # app_button.click(load_agent, inputs=[model1_input, model2_input], outputs=[model1_name, model1_score_output, model2_name, model2_score_output])