openreviewer commited on
Commit
74fe564
β€’
1 Parent(s): 6aee3a9

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +32 -32
app.py CHANGED
@@ -178,46 +178,46 @@ def setup_interface():
178
  window.onload = getUserIP;
179
  </script>
180
  """)
181
- with gr.Tabs():
182
- with gr.TabItem("Reviewer Arena"):
183
- gr.Markdown("## Reviewer Arena")
184
- gr.Markdown("Upload an academic paper to get reviews from two randomly selected LLMs.")
185
- with gr.Row():
186
- file_input = gr.File(label="Upload Academic Paper")
187
- submit_button = gr.Button("Submit!", elem_id="submit-button")
188
- with gr.Row():
189
- with gr.Column():
190
- gr.HTML("<div class='model-label'>Model A</div>")
191
- review1 = gr.Markdown()
192
- with gr.Column():
193
- gr.HTML("<div class='model-label'>Model B</div>")
194
- review2 = gr.Markdown()
195
 
196
- vote_options = ["πŸ‘ A is better", "πŸ‘ B is better", "πŸ‘” Tie", "πŸ‘Ž Both are bad"]
197
- vote = gr.Radio(label="Vote on the best model", choices=vote_options, value="Tie", visible=False)
198
- vote_button = gr.Button("Submit Vote", visible=False)
199
- vote_message = gr.HTML("", visible=False)
200
- another_paper_button = gr.Button("Review another paper", visible=False)
201
 
202
- model_identity_message = gr.HTML("", visible=False)
203
 
204
- def handle_vote_interface(vote, model_identity_message_a, model_identity_message_b, paper_content, user_ip):
205
- return handle_vote(vote, model_identity_message_a, model_identity_message_b, paper_content, user_ip)
206
 
207
- submit_button.click(fn=review_papers, inputs=[file_input, gr.Textbox(visible=False, value=lambda: document.getElementById('user-ip').value)],
208
- outputs=[review1, review2, vote, vote_button, model_identity_message, model_identity_message])
209
 
210
- vote_button.click(fn=handle_vote_interface, inputs=[vote, model_identity_message, model_identity_message, file_input, gr.Textbox(visible=False, value=lambda: document.getElementById('user-ip').value)],
211
- outputs=[vote_message, vote, vote_button, another_paper_button])
212
 
213
- another_paper_button.click(fn=lambda: None, inputs=None, outputs=None, js="() => { location.reload(); }")
214
 
215
- with gr.TabItem("Leaderboard"):
216
- gr.Markdown("## Leaderboard")
217
 
218
- # Fetch the leaderboard data from the database
219
- leaderboard_data = get_leaderboard()
220
- print(leaderboard_data)
221
 
222
 
223
  # Create the leaderboard HTML dynamically
 
178
  window.onload = getUserIP;
179
  </script>
180
  """)
181
+ with gr.Tabs():
182
+ with gr.TabItem("Reviewer Arena"):
183
+ gr.Markdown("## Reviewer Arena")
184
+ gr.Markdown("Upload an academic paper to get reviews from two randomly selected LLMs.")
185
+ with gr.Row():
186
+ file_input = gr.File(label="Upload Academic Paper")
187
+ submit_button = gr.Button("Submit!", elem_id="submit-button")
188
+ with gr.Row():
189
+ with gr.Column():
190
+ gr.HTML("<div class='model-label'>Model A</div>")
191
+ review1 = gr.Markdown()
192
+ with gr.Column():
193
+ gr.HTML("<div class='model-label'>Model B</div>")
194
+ review2 = gr.Markdown()
195
 
196
+ vote_options = ["πŸ‘ A is better", "πŸ‘ B is better", "πŸ‘” Tie", "πŸ‘Ž Both are bad"]
197
+ vote = gr.Radio(label="Vote on the best model", choices=vote_options, value="Tie", visible=False)
198
+ vote_button = gr.Button("Submit Vote", visible=False)
199
+ vote_message = gr.HTML("", visible=False)
200
+ another_paper_button = gr.Button("Review another paper", visible=False)
201
 
202
+ model_identity_message = gr.HTML("", visible=False)
203
 
204
+ def handle_vote_interface(vote, model_identity_message_a, model_identity_message_b, paper_content, user_ip):
205
+ return handle_vote(vote, model_identity_message_a, model_identity_message_b, paper_content, user_ip)
206
 
207
+ submit_button.click(fn=review_papers, inputs=[file_input, gr.Textbox(visible=False, value=lambda: document.getElementById('user-ip').value)],
208
+ outputs=[review1, review2, vote, vote_button, model_identity_message, model_identity_message])
209
 
210
+ vote_button.click(fn=handle_vote_interface, inputs=[vote, model_identity_message, model_identity_message, file_input, gr.Textbox(visible=False, value=lambda: document.getElementById('user-ip').value)],
211
+ outputs=[vote_message, vote, vote_button, another_paper_button])
212
 
213
+ another_paper_button.click(fn=lambda: None, inputs=None, outputs=None, js="() => { location.reload(); }")
214
 
215
+ with gr.TabItem("Leaderboard"):
216
+ gr.Markdown("## Leaderboard")
217
 
218
+ # Fetch the leaderboard data from the database
219
+ leaderboard_data = get_leaderboard()
220
+ print(leaderboard_data)
221
 
222
 
223
  # Create the leaderboard HTML dynamically