Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
|
|
27 |
start_time = time.time()
|
28 |
|
29 |
if not video_path:
|
30 |
-
return [gr.Markdown("Please upload a video file.")] + [
|
31 |
|
32 |
# Convert the display name to the language code
|
33 |
language = LANGUAGE_MAP[language_display_name]
|
@@ -67,22 +67,22 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
|
|
67 |
speaker_explanations = explanations[speaker_id]
|
68 |
|
69 |
output_components.extend([
|
70 |
-
gr.Markdown(f"### {speaker_id}"),
|
71 |
-
speaker_charts.get("attachment", None),
|
72 |
-
speaker_explanations.get("attachment", ""),
|
73 |
-
speaker_charts.get("dimensions", None),
|
74 |
-
speaker_charts.get("bigfive", None),
|
75 |
-
speaker_explanations.get("bigfive", ""),
|
76 |
-
speaker_charts.get("personality", None),
|
77 |
-
speaker_explanations.get("personality", ""),
|
78 |
])
|
79 |
|
80 |
# Add the transcript at the end
|
81 |
-
output_components.append(transcription)
|
82 |
|
83 |
-
# Pad the output with
|
84 |
while len(output_components) < 49:
|
85 |
-
output_components.append(
|
86 |
|
87 |
# Add the execution time
|
88 |
output_components.append(f"Completed in {int(execution_time)} seconds.")
|
@@ -101,16 +101,18 @@ with gr.Blocks() as iface:
|
|
101 |
analyze_button = gr.Button("Analyze")
|
102 |
|
103 |
# Create placeholders for output components
|
104 |
-
output_components = [
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
|
|
|
|
114 |
output_components.append(gr.Textbox(label="Transcript", lines=10, visible=False))
|
115 |
execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
|
116 |
|
|
|
27 |
start_time = time.time()
|
28 |
|
29 |
if not video_path:
|
30 |
+
return [gr.Markdown("Please upload a video file.")] + [gr.update(visible=False)] * 48 + ["Analysis not started."]
|
31 |
|
32 |
# Convert the display name to the language code
|
33 |
language = LANGUAGE_MAP[language_display_name]
|
|
|
67 |
speaker_explanations = explanations[speaker_id]
|
68 |
|
69 |
output_components.extend([
|
70 |
+
gr.Markdown(f"### {speaker_id}", visible=True),
|
71 |
+
gr.update(value=speaker_charts.get("attachment", None), visible=True),
|
72 |
+
gr.update(value=speaker_explanations.get("attachment", ""), visible=True),
|
73 |
+
gr.update(value=speaker_charts.get("dimensions", None), visible=True),
|
74 |
+
gr.update(value=speaker_charts.get("bigfive", None), visible=True),
|
75 |
+
gr.update(value=speaker_explanations.get("bigfive", ""), visible=True),
|
76 |
+
gr.update(value=speaker_charts.get("personality", None), visible=True),
|
77 |
+
gr.update(value=speaker_explanations.get("personality", ""), visible=True),
|
78 |
])
|
79 |
|
80 |
# Add the transcript at the end
|
81 |
+
output_components.append(gr.update(value=transcription, visible=True))
|
82 |
|
83 |
+
# Pad the output with invisible components if necessary
|
84 |
while len(output_components) < 49:
|
85 |
+
output_components.append(gr.update(visible=False))
|
86 |
|
87 |
# Add the execution time
|
88 |
output_components.append(f"Completed in {int(execution_time)} seconds.")
|
|
|
101 |
analyze_button = gr.Button("Analyze")
|
102 |
|
103 |
# Create placeholders for output components
|
104 |
+
output_components = []
|
105 |
+
for _ in range(6): # Assuming maximum of 6 speakers
|
106 |
+
output_components.extend([
|
107 |
+
gr.Markdown(visible=False),
|
108 |
+
gr.Plot(visible=False),
|
109 |
+
gr.Textbox(label="Attachment Styles Explanation", visible=False),
|
110 |
+
gr.Plot(visible=False),
|
111 |
+
gr.Plot(visible=False),
|
112 |
+
gr.Textbox(label="Big Five Traits Explanation", visible=False),
|
113 |
+
gr.Plot(visible=False),
|
114 |
+
gr.Textbox(label="Personality Disorders Explanation", visible=False),
|
115 |
+
])
|
116 |
output_components.append(gr.Textbox(label="Transcript", lines=10, visible=False))
|
117 |
execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
|
118 |
|