Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -35,39 +35,31 @@ def analyze_video(video_path, progress=gr.Progress()):
|
|
35 |
|
36 |
output_components = []
|
37 |
|
38 |
-
# Add transcript
|
39 |
output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10, visible=True))
|
40 |
|
41 |
for speaker_id, speaker_charts in charts.items():
|
42 |
-
markdown_content = f"""
|
43 |
-
| {speaker_id} |
|
44 |
-
|-----------|
|
45 |
-
"""
|
46 |
speaker_explanations = explanations[speaker_id]
|
47 |
speaker_general_impression = general_impressions[speaker_id]
|
48 |
speaker_section = [
|
49 |
-
gr.Markdown(
|
50 |
gr.Textbox(value=speaker_general_impression, label="General Impression", lines=3, visible=True),
|
51 |
-
gr.Plot(value=speaker_charts
|
52 |
-
gr.Textbox(value=speaker_explanations
|
53 |
-
gr.Plot(value=speaker_charts
|
54 |
-
gr.Plot(value=speaker_charts
|
55 |
-
gr.Textbox(value=speaker_explanations
|
56 |
-
gr.Plot(value=speaker_charts
|
57 |
-
gr.Textbox(value=speaker_explanations
|
58 |
]
|
59 |
output_components.extend(speaker_section)
|
60 |
|
61 |
-
while len(output_components) < 49:
|
62 |
-
output_components.extend([gr.update(visible=False)] * 8)
|
63 |
-
|
64 |
# Add execution info
|
65 |
output_components.append(
|
66 |
gr.Textbox(value=f"Completed in {int(execution_time)} seconds.", label="Execution Information", visible=True))
|
67 |
|
68 |
return output_components
|
69 |
|
70 |
-
|
71 |
with gr.Blocks() as iface:
|
72 |
gr.Markdown("# AI Personality Detection")
|
73 |
|
@@ -107,10 +99,12 @@ with gr.Blocks() as iface:
|
|
107 |
def use_example():
|
108 |
return "examples/Scenes.From.A.Marriage.US.mp4"
|
109 |
|
|
|
|
|
110 |
analyze_button.click(
|
111 |
fn=analyze_video,
|
112 |
inputs=[video_input],
|
113 |
-
outputs=
|
114 |
show_progress=True
|
115 |
)
|
116 |
|
@@ -121,7 +115,7 @@ with gr.Blocks() as iface:
|
|
121 |
).then(
|
122 |
fn=analyze_video,
|
123 |
inputs=[video_input],
|
124 |
-
outputs=
|
125 |
show_progress=True
|
126 |
)
|
127 |
|
|
|
35 |
|
36 |
output_components = []
|
37 |
|
38 |
+
# Add transcript
|
39 |
output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10, visible=True))
|
40 |
|
41 |
for speaker_id, speaker_charts in charts.items():
|
|
|
|
|
|
|
|
|
42 |
speaker_explanations = explanations[speaker_id]
|
43 |
speaker_general_impression = general_impressions[speaker_id]
|
44 |
speaker_section = [
|
45 |
+
gr.Markdown(f"## {speaker_id}", visible=True),
|
46 |
gr.Textbox(value=speaker_general_impression, label="General Impression", lines=3, visible=True),
|
47 |
+
gr.Plot(value=speaker_charts["attachment"], visible=True),
|
48 |
+
gr.Textbox(value=speaker_explanations["attachment"], label="Attachment Styles Explanation", visible=True),
|
49 |
+
gr.Plot(value=speaker_charts["dimensions"], visible=True),
|
50 |
+
gr.Plot(value=speaker_charts["bigfive"], visible=True),
|
51 |
+
gr.Textbox(value=speaker_explanations["bigfive"], label="Big Five Traits Explanation", visible=True),
|
52 |
+
gr.Plot(value=speaker_charts["personality"], visible=True),
|
53 |
+
gr.Textbox(value=speaker_explanations["personality"], label="Personality Disorders Explanation", visible=True),
|
54 |
]
|
55 |
output_components.extend(speaker_section)
|
56 |
|
|
|
|
|
|
|
57 |
# Add execution info
|
58 |
output_components.append(
|
59 |
gr.Textbox(value=f"Completed in {int(execution_time)} seconds.", label="Execution Information", visible=True))
|
60 |
|
61 |
return output_components
|
62 |
|
|
|
63 |
with gr.Blocks() as iface:
|
64 |
gr.Markdown("# AI Personality Detection")
|
65 |
|
|
|
99 |
def use_example():
|
100 |
return "examples/Scenes.From.A.Marriage.US.mp4"
|
101 |
|
102 |
+
output_container = gr.Column()
|
103 |
+
|
104 |
analyze_button.click(
|
105 |
fn=analyze_video,
|
106 |
inputs=[video_input],
|
107 |
+
outputs=output_container,
|
108 |
show_progress=True
|
109 |
)
|
110 |
|
|
|
115 |
).then(
|
116 |
fn=analyze_video,
|
117 |
inputs=[video_input],
|
118 |
+
outputs=output_container,
|
119 |
show_progress=True
|
120 |
)
|
121 |
|