Update app.py
Browse files
app.py
CHANGED
@@ -223,9 +223,12 @@ chat_css = """
|
|
223 |
}
|
224 |
"""
|
225 |
|
226 |
-
#
|
227 |
def update_alignment(choice):
|
228 |
-
return [
|
|
|
|
|
|
|
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=
|
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(
|