xen2003 commited on
Commit
e6583e3
·
verified ·
1 Parent(s): 802cb64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -8
app.py CHANGED
@@ -573,18 +573,12 @@ with gr.Blocks() as iface:
573
  download_button = gr.Button("Download Report")
574
  clear_button = gr.Button("Clear")
575
 
 
576
  video_input.change(fn=process_video_gradio, inputs=video_input, outputs=[transcribed_text,
577
  sentiment_trend, sentiment_heatmap, sentiment_pie_chart,
578
  emotion_trend, emotion_heatmap, emotion_pie_chart
579
  ])
580
-
581
- # Link the button clicks to the functions that handle them
582
- download_button.click(fn=download_report_function, inputs=[], outputs=gr.File())
583
- clear_button.click(
584
- fn=clear_function,
585
- inputs=[],
586
- outputs=[video_input, transcribed_text, sentiment_trend, sentiment_heatmap, sentiment_pie_chart, emotion_trend, emotion_heatmap, emotion_pie_chart])
587
-
588
  # Add custom JavaScript to trigger play button after uploading
589
  instructions = gr.HTML("""
590
  <script>
@@ -599,5 +593,27 @@ with gr.Blocks() as iface:
599
  });
600
  </script>
601
  """)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
602
 
603
  iface.launch(inline=False, share=True)
 
573
  download_button = gr.Button("Download Report")
574
  clear_button = gr.Button("Clear")
575
 
576
+
577
  video_input.change(fn=process_video_gradio, inputs=video_input, outputs=[transcribed_text,
578
  sentiment_trend, sentiment_heatmap, sentiment_pie_chart,
579
  emotion_trend, emotion_heatmap, emotion_pie_chart
580
  ])
581
+
 
 
 
 
 
 
 
582
  # Add custom JavaScript to trigger play button after uploading
583
  instructions = gr.HTML("""
584
  <script>
 
593
  });
594
  </script>
595
  """)
596
+
597
+
598
+ # Link the button clicks to the functions that handle them
599
+ download_button.click(fn=download_report_function, inputs=[], outputs=gr.File())
600
+ # JavaScript to Open PDF in a New Tab
601
+ gr.HTML("""
602
+ <script>
603
+ function openPDF() {
604
+ var link = document.createElement('a');
605
+ link.href = 'example.pdf'; // Ensure the correct path
606
+ link.target = '_blank';
607
+ link.click();
608
+ }
609
+ </script>
610
+ <button onclick="openPDF()">Open PDF</button>
611
+ """)
612
+
613
+ clear_button.click(
614
+ fn=clear_function,
615
+ inputs=[],
616
+ outputs=[video_input, transcribed_text, sentiment_trend, sentiment_heatmap, sentiment_pie_chart, emotion_trend, emotion_heatmap, emotion_pie_chart])
617
+
618
 
619
  iface.launch(inline=False, share=True)