reab5555 commited on
Commit
95c25ea
·
verified ·
1 Parent(s): e7e2341

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import gradio as gr
2
  from processing import process_input
3
  from visualization import update_visibility_and_charts
4
- import cv2
5
  import os
6
 
7
  def create_interface():
@@ -13,9 +12,10 @@ def create_interface():
13
 
14
  with gr.Row():
15
  input_file = gr.File(label="Upload File (TXT, PDF, or Video)")
16
- with gr.Column():
17
- example_button = gr.Button("Use Example Video")
18
- example_video = gr.Video(label="Example Video Preview", visible=True)
 
19
 
20
  with gr.Column():
21
  progress = gr.Progress()
@@ -42,7 +42,7 @@ def create_interface():
42
  return update_visibility_and_charts(*results)
43
 
44
  def use_example_video():
45
- return gr.update(value=example_video_path, visible=True), example_video_path
46
 
47
  input_file.upload(
48
  fn=process_and_update,
@@ -53,7 +53,7 @@ def create_interface():
53
  example_button.click(
54
  fn=use_example_video,
55
  inputs=[],
56
- outputs=[example_video, input_file]
57
  ).then(
58
  fn=process_and_update,
59
  inputs=[input_file],
 
1
  import gradio as gr
2
  from processing import process_input
3
  from visualization import update_visibility_and_charts
 
4
  import os
5
 
6
  def create_interface():
 
12
 
13
  with gr.Row():
14
  input_file = gr.File(label="Upload File (TXT, PDF, or Video)")
15
+ example_button = gr.Button("Use Example Video")
16
+
17
+ # Load the video directly when creating the interface
18
+ example_video = gr.Video(value=example_video_path, label="Example Video Preview")
19
 
20
  with gr.Column():
21
  progress = gr.Progress()
 
42
  return update_visibility_and_charts(*results)
43
 
44
  def use_example_video():
45
+ return example_video_path
46
 
47
  input_file.upload(
48
  fn=process_and_update,
 
53
  example_button.click(
54
  fn=use_example_video,
55
  inputs=[],
56
+ outputs=input_file
57
  ).then(
58
  fn=process_and_update,
59
  inputs=[input_file],