Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -97,12 +97,12 @@ def vote_up_model(state, chatbot,chatbot2):
|
|
97 |
update_message = update_ratings(state, 0)
|
98 |
chatbot.append((update_message[0]))
|
99 |
chatbot2.append((update_message[1]))
|
100 |
-
return chatbot, chatbot2,gr.Button.update(interactive=False),gr.Button.update(interactive=False) # Disable voting buttons
|
101 |
def vote_down_model(state, chatbot,chatbot2):
|
102 |
update_message = update_ratings(state, 1)
|
103 |
chatbot2.append((update_message[0]))
|
104 |
chatbot.append((update_message[1]))
|
105 |
-
return chatbot,chatbot2, gr.Button.update(interactive=False),gr.Button.update(interactive=False) # Disable voting buttons
|
106 |
|
107 |
def user_ask(state, chatbot1, chatbot2, textbox):
|
108 |
global enable_btn
|
@@ -165,10 +165,10 @@ with gr.Blocks() as demo:
|
|
165 |
reset_btn.click(clear_chat, inputs=[state], outputs=[state, chatbot1, chatbot2, upvote_btn_a, upvote_btn_b])
|
166 |
textbox.submit(user_ask, inputs=[state, chatbot1, chatbot2, textbox], outputs=[state, chatbot1, chatbot2, textbox,upvote_btn_a,upvote_btn_b])
|
167 |
submit_btn.click(user_ask, inputs=[state, chatbot1, chatbot2, textbox], outputs=[state, chatbot1, chatbot2, textbox,upvote_btn_a,upvote_btn_b])
|
168 |
-
upvote_btn_a.click(vote_up_model, inputs=[state, chatbot1,chatbot2], outputs=[chatbot1,chatbot2,upvote_btn_a,upvote_btn_b])
|
169 |
-
upvote_btn_b.click(vote_down_model, inputs=[state, chatbot1,chatbot2], outputs=[chatbot1,chatbot2,upvote_btn_a,upvote_btn_b])
|
170 |
with gr.Tab("Leaderboard"):
|
171 |
-
leaderboard = gr.Dataframe()
|
172 |
refresh_btn = gr.Button("Refresh Leaderboard")
|
173 |
|
174 |
# Function to refresh leaderboard
|
|
|
97 |
update_message = update_ratings(state, 0)
|
98 |
chatbot.append((update_message[0]))
|
99 |
chatbot2.append((update_message[1]))
|
100 |
+
return chatbot, chatbot2,gr.Button.update(interactive=False),gr.Button.update(interactive=False),gr.Textbox.update(interactive=False),gr.Button.update(interactive=False) # Disable voting buttons
|
101 |
def vote_down_model(state, chatbot,chatbot2):
|
102 |
update_message = update_ratings(state, 1)
|
103 |
chatbot2.append((update_message[0]))
|
104 |
chatbot.append((update_message[1]))
|
105 |
+
return chatbot,chatbot2, gr.Button.update(interactive=False),gr.Button.update(interactive=False),gr.Textbox.update(interactive=False),gr.Button.update(interactive=False) # Disable voting buttons
|
106 |
|
107 |
def user_ask(state, chatbot1, chatbot2, textbox):
|
108 |
global enable_btn
|
|
|
165 |
reset_btn.click(clear_chat, inputs=[state], outputs=[state, chatbot1, chatbot2, upvote_btn_a, upvote_btn_b])
|
166 |
textbox.submit(user_ask, inputs=[state, chatbot1, chatbot2, textbox], outputs=[state, chatbot1, chatbot2, textbox,upvote_btn_a,upvote_btn_b])
|
167 |
submit_btn.click(user_ask, inputs=[state, chatbot1, chatbot2, textbox], outputs=[state, chatbot1, chatbot2, textbox,upvote_btn_a,upvote_btn_b])
|
168 |
+
upvote_btn_a.click(vote_up_model, inputs=[state, chatbot1,chatbot2], outputs=[chatbot1,chatbot2,upvote_btn_a,upvote_btn_b,textbox,submit_btn])
|
169 |
+
upvote_btn_b.click(vote_down_model, inputs=[state, chatbot1,chatbot2], outputs=[chatbot1,chatbot2,upvote_btn_a,upvote_btn_b,textbox,submit_btn])
|
170 |
with gr.Tab("Leaderboard"):
|
171 |
+
leaderboard = gr.Dataframe(generate_leaderboard())
|
172 |
refresh_btn = gr.Button("Refresh Leaderboard")
|
173 |
|
174 |
# Function to refresh leaderboard
|