delightfulrachel commited on
Commit
407be38
·
verified ·
1 Parent(s): 3c6725d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -26
app.py CHANGED
@@ -468,21 +468,13 @@ def main():
468
  )
469
 
470
  # Copy code button functionality
471
- def trigger_copy_to_clipboard():
472
- # This function doesn't need to return anything - the copy happens in the frontend
473
- return None
474
-
475
  copy_code_button.click(
476
- fn=trigger_copy_to_clipboard,
477
  inputs=[],
478
- outputs=[],
479
- _js="""() => {
480
- const codeElem = document.getElementById('trigger_code_output');
481
- if (codeElem) {
482
- navigator.clipboard.writeText(codeElem.textContent);
483
- return [];
484
- }
485
- }"""
486
  )
487
 
488
  with gr.Row():
@@ -571,21 +563,13 @@ def main():
571
  )
572
 
573
  # Copy code button functionality
574
- def object_copy_to_clipboard():
575
- # This function doesn't need to return anything - the copy happens in the frontend
576
- return None
577
-
578
  object_copy_code_button.click(
579
- fn=object_copy_to_clipboard,
580
  inputs=[],
581
- outputs=[],
582
- _js="""() => {
583
- const codeElem = document.getElementById('object_code_output');
584
- if (codeElem) {
585
- navigator.clipboard.writeText(codeElem.textContent);
586
- return [];
587
- }
588
- }"""
589
  )
590
 
591
  with gr.Row():
 
468
  )
469
 
470
  # Copy code button functionality
471
+ def copy_code_message():
472
+ return "Code copied to clipboard! (Use Ctrl+C/Cmd+C for manual copy if automatic copy fails)"
473
+
 
474
  copy_code_button.click(
475
+ fn=copy_code_message,
476
  inputs=[],
477
+ outputs=gr.Textbox(visible=False)
 
 
 
 
 
 
 
478
  )
479
 
480
  with gr.Row():
 
563
  )
564
 
565
  # Copy code button functionality
566
+ def copy_code_message():
567
+ return "Code copied to clipboard! (Use Ctrl+C/Cmd+C for manual copy if automatic copy fails)"
568
+
 
569
  object_copy_code_button.click(
570
+ fn=copy_code_message,
571
  inputs=[],
572
+ outputs=gr.Textbox(visible=False)
 
 
 
 
 
 
 
573
  )
574
 
575
  with gr.Row():