cetusian commited on
Commit
559deca
·
verified ·
1 Parent(s): bc4762e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -126,11 +126,13 @@ def create_demo():
126
  outputs=[response[2] for response in response_boxes],
127
  )
128
 
 
 
129
  for model_name, _, _, vote_button, vote_count in response_boxes:
130
  vote_button.click(
131
  lambda votes, name=model_name: handle_votes(votes, name),
132
  inputs=[vote_state],
133
- outputs=[vote_state, vote_count], # Update both the state and the UI element
134
  )
135
 
136
 
 
126
  outputs=[response[2] for response in response_boxes],
127
  )
128
 
129
+ vote_state = gr.State([0] * len(model_options)) # One vote count per model
130
+
131
  for model_name, _, _, vote_button, vote_count in response_boxes:
132
  vote_button.click(
133
  lambda votes, name=model_name: handle_votes(votes, name),
134
  inputs=[vote_state],
135
+ outputs=[vote_state, vote_count], # Update state and display vote count
136
  )
137
 
138