khang119966 commited on
Commit
92f4618
·
verified ·
1 Parent(s): f8db3ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -249,6 +249,8 @@ button.svelte-1lcyrx4[aria-label="user's message: a file of type image/jpeg, "]
249
  position: relative;
250
  margin-bottom: var(--spacing-lg);
251
  }
 
 
252
  """
253
 
254
  js = """
@@ -287,8 +289,9 @@ demo = gr.Blocks(css=CSS,js=js, theme='NoCrypt/miku')
287
 
288
  # Hàm bật/tắt Think Mode
289
  def toggle_think_mode(current_state):
290
- return not current_state
291
-
 
292
 
293
 
294
  with demo:
@@ -311,11 +314,11 @@ with demo:
311
  theme='NoCrypt/miku'
312
  )
313
 
314
- with gr.Row():
315
- think_button = gr.Button("🧠 Think Mode", variant="secondary") # Nút bật/tắt
316
 
317
- # Khi nhấn nút, trạng thái think_mode thay đổi
318
- think_button.click(toggle_think_mode, inputs=[think_mode], outputs=[think_mode])
319
 
320
  # mic_transcribe = gr.Interface(
321
  # fn=transcribe_speech,
 
249
  position: relative;
250
  margin-bottom: var(--spacing-lg);
251
  }
252
+
253
+ #think-button { position: absolute; bottom: 10px; left: 10px; font-size: 12px; padding: 5px 10px; }
254
  """
255
 
256
  js = """
 
289
 
290
  # Hàm bật/tắt Think Mode
291
  def toggle_think_mode(current_state):
292
+ new_state = not current_state
293
+ button_label = "💡Think✅" if new_state else "💡Think"
294
+ return new_state, button_label
295
 
296
 
297
  with demo:
 
314
  theme='NoCrypt/miku'
315
  )
316
 
317
+ with gr.Row(variant="compact"):
318
+ think_button = gr.Button("💡Think", elem_id="think-button", variant="secondary")
319
 
320
+ # Khi nhấn nút, trạng thái think_mode thay đổi + đổi nhãn nút
321
+ think_button.click(toggle_think_mode, inputs=[think_mode], outputs=[think_mode, think_button])
322
 
323
  # mic_transcribe = gr.Interface(
324
  # fn=transcribe_speech,