Kang Suhyun commited on
Commit
61f356c
1 Parent(s): 65566f3

[#72|#73|#74] Upgrade Gradio and remove stream response simulation (#76)

Browse files

This change upgrades Gradio. It will fix
1. Missing translation language selection dropdowns post-summary generation issue
2. Missing vote button issue

Also the custom JS code for simulating stream response has been removed since it causes the response printing to be stopped.

Files changed (2) hide show
  1. app.py +7 -24
  2. requirements.txt +4 -4
app.py CHANGED
@@ -60,13 +60,8 @@ def vote(vote_button, response_a, response_b, model_a_name, model_b_name,
60
  raise gr.Error("Please select a response type.")
61
 
62
 
63
- def scroll_to_bottom_js(elem_id):
64
- return f"""
65
- () => {{
66
- const element = document.querySelector("#{elem_id} textarea");
67
- element.scrollTop = element.scrollHeight;
68
- }}
69
- """
70
 
71
 
72
  # Removes the persistent orange border from the leaderboard, which
@@ -115,21 +110,9 @@ with gr.Blocks(title="Arena", css=css) as app:
115
 
116
  with gr.Group():
117
  with gr.Row():
118
- response_a_elem_id = "responseA"
119
- response_a_textbox = gr.Textbox(label="Model A",
120
- interactive=False,
121
- elem_id=response_a_elem_id)
122
- response_a_textbox.change(fn=None,
123
- js=scroll_to_bottom_js(response_a_elem_id))
124
- response_boxes[0] = response_a_textbox
125
-
126
- response_b_elem_id = "responseB"
127
- response_b_textbox = gr.Textbox(label="Model B",
128
- interactive=False,
129
- elem_id=response_b_elem_id)
130
- response_b_textbox.change(fn=None,
131
- js=scroll_to_bottom_js(response_b_elem_id))
132
- response_boxes[1] = response_b_textbox
133
 
134
  with gr.Row(visible=False) as model_name_row:
135
  model_names[0] = gr.Textbox(show_label=False)
@@ -149,8 +132,8 @@ with gr.Blocks(title="Arena", css=css) as app:
149
  outputs=response_boxes + model_names + [instruction_state]).success(
150
  fn=lambda: [gr.Row(visible=True)
151
  ] + [gr.Button(interactive=True) for _ in range(3)],
152
- outputs=[vote_row] + vote_buttons).then(
153
- fn=lambda: [gr.Button(interactive=True)], outputs=[submit])
154
 
155
  submit.click(fn=lambda: [
156
  gr.Button(interactive=False),
 
60
  raise gr.Error("Please select a response type.")
61
 
62
 
63
+ def activate_button():
64
+ return gr.Button(interactive=True)
 
 
 
 
 
65
 
66
 
67
  # Removes the persistent orange border from the leaderboard, which
 
110
 
111
  with gr.Group():
112
  with gr.Row():
113
+ response_boxes[0] = gr.Textbox(label="Model A", interactive=False)
114
+
115
+ response_boxes[1] = gr.Textbox(label="Model B", interactive=False)
 
 
 
 
 
 
 
 
 
 
 
 
116
 
117
  with gr.Row(visible=False) as model_name_row:
118
  model_names[0] = gr.Textbox(show_label=False)
 
132
  outputs=response_boxes + model_names + [instruction_state]).success(
133
  fn=lambda: [gr.Row(visible=True)
134
  ] + [gr.Button(interactive=True) for _ in range(3)],
135
+ outputs=[vote_row] + vote_buttons).then(fn=activate_button,
136
+ outputs=submit)
137
 
138
  submit.click(fn=lambda: [
139
  gr.Button(interactive=False),
requirements.txt CHANGED
@@ -37,8 +37,8 @@ google-cloud-storage==2.14.0
37
  google-crc32c==1.5.0
38
  google-resumable-media==2.7.0
39
  googleapis-common-protos==1.62.0
40
- gradio==4.16.0
41
- gradio_client==0.8.1
42
  grpc-google-iam-v1==0.13.0
43
  grpcio==1.60.1
44
  grpcio-status==1.60.1
@@ -80,7 +80,7 @@ PyJWT==2.8.0
80
  pyparsing==3.1.1
81
  python-dateutil==2.8.2
82
  python-dotenv==1.0.1
83
- python-multipart==0.0.7
84
  pytz==2024.1
85
  PyYAML==6.0.1
86
  referencing==0.33.0
@@ -89,7 +89,7 @@ requests==2.31.0
89
  rich==13.7.0
90
  rpds-py==0.17.1
91
  rsa==4.9
92
- ruff==0.2.0
93
  semantic-version==2.10.0
94
  shapely==2.0.3
95
  shellingham==1.5.4
 
37
  google-crc32c==1.5.0
38
  google-resumable-media==2.7.0
39
  googleapis-common-protos==1.62.0
40
+ gradio==4.22.0
41
+ gradio_client==0.13.0
42
  grpc-google-iam-v1==0.13.0
43
  grpcio==1.60.1
44
  grpcio-status==1.60.1
 
80
  pyparsing==3.1.1
81
  python-dateutil==2.8.2
82
  python-dotenv==1.0.1
83
+ python-multipart==0.0.9
84
  pytz==2024.1
85
  PyYAML==6.0.1
86
  referencing==0.33.0
 
89
  rich==13.7.0
90
  rpds-py==0.17.1
91
  rsa==4.9
92
+ ruff==0.3.4
93
  semantic-version==2.10.0
94
  shapely==2.0.3
95
  shellingham==1.5.4