bakrianoo commited on
Commit
f039cae
·
1 Parent(s): 186544d

show debug info in the sidebar

Browse files
Files changed (1) hide show
  1. app.py +6 -14
app.py CHANGED
@@ -353,8 +353,7 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
353
  # Debug info state and modal components
354
  debug_info_state = gr.State(None)
355
 
356
- with gr.Blocks() as debug_modal:
357
- debug_markdown = gr.Markdown("Debug information will appear here.")
358
 
359
  # Pre-define section textboxes and related components
360
  gr.Markdown("### Article Sections")
@@ -381,7 +380,7 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
381
  api_key,
382
  model_id,
383
  base_url,
384
- preference_prompt, # Add preference prompt to inputs
385
  debug_mode
386
  ],
387
  outputs=[translation_output, debug_info_state]
@@ -394,16 +393,9 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
394
  outputs=[debug_btn]
395
  )
396
 
397
- # Connect debug button to show modal with debug info
398
- debug_btn.click(
399
- fn=format_debug_info,
400
- inputs=[debug_info_state],
401
- outputs=[debug_markdown]
402
- ).then(
403
- fn=lambda: True,
404
- outputs=[debug_modal]
405
- )
406
-
407
  # Connect the extract button to the function
408
  extract_button.click(
409
  fn=extract_wikipedia_content,
@@ -444,7 +436,7 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as demo:
444
  for i in range(0, len(section_components), 4):
445
  debug_btn = section_components[i+3] # The debug button is the 4th component
446
 
447
- # Re-connect debug button with proper click handling
448
  debug_btn.click(
449
  fn=format_debug_info,
450
  inputs=[debug_info_state],
 
353
  # Debug info state and modal components
354
  debug_info_state = gr.State(None)
355
 
356
+ # Remove the debug_markdown from the main area as we'll only use the sidebar for debug info
 
357
 
358
  # Pre-define section textboxes and related components
359
  gr.Markdown("### Article Sections")
 
380
  api_key,
381
  model_id,
382
  base_url,
383
+ preference_prompt,
384
  debug_mode
385
  ],
386
  outputs=[translation_output, debug_info_state]
 
393
  outputs=[debug_btn]
394
  )
395
 
396
+ # Update this to only show the debug info in the sidebar
397
+ # We'll reconnect this later in the code
398
+
 
 
 
 
 
 
 
399
  # Connect the extract button to the function
400
  extract_button.click(
401
  fn=extract_wikipedia_content,
 
436
  for i in range(0, len(section_components), 4):
437
  debug_btn = section_components[i+3] # The debug button is the 4th component
438
 
439
+ # Connect debug button directly to show debug info only in the sidebar
440
  debug_btn.click(
441
  fn=format_debug_info,
442
  inputs=[debug_info_state],