Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -52,6 +52,7 @@ def analyze_video(video_path, max_speakers, progress=gr.Progress()):
|
|
52 |
gr.Textbox(value=speaker_explanations.get("bigfive", ""), label="Big Five Traits Explanation", visible=True),
|
53 |
gr.Plot(value=speaker_charts.get("personality", None), visible=True),
|
54 |
gr.Textbox(value=speaker_explanations.get("personality", ""), label="Personality Disorders Explanation", visible=True),
|
|
|
55 |
]
|
56 |
|
57 |
output_components.extend(speaker_section)
|
@@ -67,13 +68,14 @@ def analyze_video(video_path, max_speakers, progress=gr.Progress()):
|
|
67 |
gr.Textbox(visible=False),
|
68 |
gr.Plot(visible=False),
|
69 |
gr.Textbox(visible=False),
|
|
|
70 |
])
|
71 |
|
72 |
# Add the transcript at the end
|
73 |
output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10, visible=True))
|
74 |
|
75 |
-
# Add the execution time
|
76 |
-
output_components.
|
77 |
|
78 |
return output_components
|
79 |
|
@@ -87,6 +89,15 @@ with gr.Blocks() as iface:
|
|
87 |
|
88 |
analyze_button = gr.Button("Analyze")
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
# Create placeholders for output components
|
91 |
output_components = []
|
92 |
for _ in range(6): # Assuming maximum of 6 speakers
|
@@ -99,20 +110,10 @@ with gr.Blocks() as iface:
|
|
99 |
gr.Textbox(label="Big Five Traits Explanation", visible=False),
|
100 |
gr.Plot(visible=False),
|
101 |
gr.Textbox(label="Personality Disorders Explanation", visible=False),
|
|
|
102 |
])
|
103 |
output_components.append(gr.Textbox(label="Transcript", lines=10, visible=False))
|
104 |
-
execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
|
105 |
-
|
106 |
-
output_components.append(execution_info_box)
|
107 |
-
|
108 |
-
analyze_button.click(
|
109 |
-
fn=analyze_video,
|
110 |
-
inputs=[video_input, max_speakers],
|
111 |
-
outputs=output_components,
|
112 |
-
show_progress=True
|
113 |
-
)
|
114 |
|
115 |
# Launch the app
|
116 |
if __name__ == "__main__":
|
117 |
iface.launch()
|
118 |
-
|
|
|
52 |
gr.Textbox(value=speaker_explanations.get("bigfive", ""), label="Big Five Traits Explanation", visible=True),
|
53 |
gr.Plot(value=speaker_charts.get("personality", None), visible=True),
|
54 |
gr.Textbox(value=speaker_explanations.get("personality", ""), label="Personality Disorders Explanation", visible=True),
|
55 |
+
gr.Markdown("---", visible=True), # Separator for distinct speaker sections
|
56 |
]
|
57 |
|
58 |
output_components.extend(speaker_section)
|
|
|
68 |
gr.Textbox(visible=False),
|
69 |
gr.Plot(visible=False),
|
70 |
gr.Textbox(visible=False),
|
71 |
+
gr.Markdown(visible=False), # Placeholder for separator
|
72 |
])
|
73 |
|
74 |
# Add the transcript at the end
|
75 |
output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10, visible=True))
|
76 |
|
77 |
+
# Add the execution time at the top
|
78 |
+
output_components.insert(0, gr.Textbox(value=f"Completed in {int(execution_time)} seconds.", label="Execution Information", visible=True))
|
79 |
|
80 |
return output_components
|
81 |
|
|
|
89 |
|
90 |
analyze_button = gr.Button("Analyze")
|
91 |
|
92 |
+
# Execution Information box directly below the Analyze button
|
93 |
+
execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
|
94 |
+
analyze_button.click(
|
95 |
+
fn=analyze_video,
|
96 |
+
inputs=[video_input, max_speakers],
|
97 |
+
outputs=[execution_info_box] + output_components,
|
98 |
+
show_progress=True
|
99 |
+
)
|
100 |
+
|
101 |
# Create placeholders for output components
|
102 |
output_components = []
|
103 |
for _ in range(6): # Assuming maximum of 6 speakers
|
|
|
110 |
gr.Textbox(label="Big Five Traits Explanation", visible=False),
|
111 |
gr.Plot(visible=False),
|
112 |
gr.Textbox(label="Personality Disorders Explanation", visible=False),
|
113 |
+
gr.Markdown("---", visible=False), # Placeholder for separator
|
114 |
])
|
115 |
output_components.append(gr.Textbox(label="Transcript", lines=10, visible=False))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
# Launch the app
|
118 |
if __name__ == "__main__":
|
119 |
iface.launch()
|
|