CK42 commited on
Commit
da4611f
1 Parent(s): c47707d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -1,8 +1,14 @@
 
1
  import gradio as gr
 
2
  import requests.exceptions
3
  from huggingface_hub import HfApi, hf_hub_download
4
  from huggingface_hub.repocard import metadata_load
5
 
 
 
 
 
6
  app = gr.Blocks()
7
 
8
  def load_agent(model_id_1, model_id_2):
@@ -16,18 +22,12 @@ def load_agent(model_id_1, model_id_2):
16
  # Get the accuracy
17
  results_1 = parse_metrics_accuracy(metadata_1)
18
 
19
- # Load the video
20
- #video_path_1 = hf_hub_download(model_id_1, filename="replay.mp4")
21
-
22
  # Load the metrics
23
  metadata_2 = get_metadata(model_id_2)
24
 
25
  # Get the accuracy
26
  results_2 = parse_metrics_accuracy(metadata_2)
27
-
28
- # Load the video
29
- #video_path_2 = hf_hub_download(model_id_2, filename="replay.mp4")
30
-
31
  return model_id_1, results_1, model_id_2, results_2
32
 
33
  def parse_metrics_accuracy(meta):
@@ -53,8 +53,6 @@ def get_metadata(model_id):
53
  return None
54
 
55
 
56
-
57
-
58
  with app:
59
  gr.Markdown(
60
  """
@@ -71,11 +69,11 @@ with app:
71
  with gr.Column():
72
  model1_name = gr.Markdown()
73
  #model1_video_output = gr.Video()
74
- model1_score_output = gr.Textbox(label="Mean Reward +/- Std Reward")
75
  with gr.Column():
76
  model2_name = gr.Markdown()
77
  #model2_video_output = gr.Video()
78
- model2_score_output = gr.Textbox(label="Mean Reward +/- Std Reward")
79
 
80
  app_button.click(load_agent, inputs=[model1_input, model2_input], outputs=[model1_name, model1_score_output, model2_name, model2_score_output])
81
 
 
1
+ import sklearn
2
  import gradio as gr
3
+ import joblib
4
  import requests.exceptions
5
  from huggingface_hub import HfApi, hf_hub_download
6
  from huggingface_hub.repocard import metadata_load
7
 
8
+ pipe = joblib.load("./pipeline.pkl")
9
+ inputs = [gr.Textbox(value = "The customer service was satisfactory.")]
10
+ outputs = [gr.Label(label = "Sentiment")]
11
+ title = "Sentiment Analysis"
12
  app = gr.Blocks()
13
 
14
  def load_agent(model_id_1, model_id_2):
 
22
  # Get the accuracy
23
  results_1 = parse_metrics_accuracy(metadata_1)
24
 
 
 
 
25
  # Load the metrics
26
  metadata_2 = get_metadata(model_id_2)
27
 
28
  # Get the accuracy
29
  results_2 = parse_metrics_accuracy(metadata_2)
30
+
 
 
 
31
  return model_id_1, results_1, model_id_2, results_2
32
 
33
  def parse_metrics_accuracy(meta):
 
53
  return None
54
 
55
 
 
 
56
  with app:
57
  gr.Markdown(
58
  """
 
69
  with gr.Column():
70
  model1_name = gr.Markdown()
71
  #model1_video_output = gr.Video()
72
+ model1_score_output = gr.Textbox(label="Sentiment")
73
  with gr.Column():
74
  model2_name = gr.Markdown()
75
  #model2_video_output = gr.Video()
76
+ model2_score_output = gr.Textbox(label="Sentiment")
77
 
78
  app_button.click(load_agent, inputs=[model1_input, model2_input], outputs=[model1_name, model1_score_output, model2_name, model2_score_output])
79