reab5555 commited on
Commit
1641d0b
·
verified ·
1 Parent(s): ca6d20b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -4
app.py CHANGED
@@ -71,10 +71,20 @@ def analyze_video(video_path, progress=gr.Progress()):
71
 
72
  with gr.Blocks() as iface:
73
  gr.Markdown("# AI Personality Detection")
74
- gr.Markdown("Upload a video")
75
-
76
- video_input = gr.Video(label="Upload Video")
77
- analyze_button = gr.Button("Analyze")
 
 
 
 
 
 
 
 
 
 
78
 
79
  # Create output components
80
  output_components = []
@@ -99,6 +109,9 @@ with gr.Blocks() as iface:
99
  transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
100
  output_components.append(transcript_output)
101
 
 
 
 
102
  analyze_button.click(
103
  fn=analyze_video,
104
  inputs=[video_input],
@@ -106,5 +119,16 @@ with gr.Blocks() as iface:
106
  show_progress=True
107
  )
108
 
 
 
 
 
 
 
 
 
 
 
 
109
  if __name__ == "__main__":
110
  iface.launch()
 
71
 
72
  with gr.Blocks() as iface:
73
  gr.Markdown("# AI Personality Detection")
74
+
75
+ with gr.Row():
76
+ with gr.Column(scale=3):
77
+ gr.Markdown("Upload a video")
78
+ video_input = gr.Video(label="Upload Video")
79
+ with gr.Column(scale=1):
80
+ gr.Markdown("Example Video")
81
+ example_video = gr.Video("examples/Scenes.From.A.Marriage.US.mp4", label="Example Video")
82
+
83
+ with gr.Row():
84
+ with gr.Column(scale=3):
85
+ analyze_button = gr.Button("Analyze")
86
+ with gr.Column(scale=1):
87
+ use_example_button = gr.Button("Use Example Video")
88
 
89
  # Create output components
90
  output_components = []
 
109
  transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
110
  output_components.append(transcript_output)
111
 
112
+ def use_example():
113
+ return "examples/Scenes.From.A.Marriage.US.mp4"
114
+
115
  analyze_button.click(
116
  fn=analyze_video,
117
  inputs=[video_input],
 
119
  show_progress=True
120
  )
121
 
122
+ use_example_button.click(
123
+ fn=use_example,
124
+ inputs=[],
125
+ outputs=[video_input],
126
+ ).then(
127
+ fn=analyze_video,
128
+ inputs=[video_input],
129
+ outputs=output_components,
130
+ show_progress=True
131
+ )
132
+
133
  if __name__ == "__main__":
134
  iface.launch()