demetz commited on
Commit
95549b3
·
verified ·
1 Parent(s): 90f08e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -223,9 +223,12 @@ chat_css = """
223
  }
224
  """
225
 
226
- # Function to update button classes
227
  def update_alignment(choice):
228
- return [gr.Button.update(variant="secondary", elem_classes=["alignment-btn", "selected"] if choice == c else ["alignment-btn"]) for c in alignment_choices], choice
 
 
 
229
 
230
  # === GUI ===
231
  with gr.Blocks(css=chat_css) as chatbot:
@@ -248,7 +251,7 @@ with gr.Blocks(css=chat_css) as chatbot:
248
  btn.click(
249
  fn=update_alignment,
250
  inputs=[gr.State(choice)],
251
- outputs=[buttons, selected_alignment]
252
  )
253
 
254
  gr.ChatInterface(
 
223
  }
224
  """
225
 
226
+ # === Button state update function ===
227
  def update_alignment(choice):
228
+ return [
229
+ gr.Button.update(elem_classes=["alignment-btn", "selected"] if choice == c else ["alignment-btn"])
230
+ for c in alignment_choices
231
+ ] + [choice] # Last item is selected_alignment output
232
 
233
  # === GUI ===
234
  with gr.Blocks(css=chat_css) as chatbot:
 
251
  btn.click(
252
  fn=update_alignment,
253
  inputs=[gr.State(choice)],
254
+ outputs=buttons + [selected_alignment] # ✅ Fixed here
255
  )
256
 
257
  gr.ChatInterface(