Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,67 @@ def use_example():
|
|
70 |
return "examples/Scenes.From.A.Marriage.US.mp4"
|
71 |
|
72 |
with gr.Blocks() as iface:
|
73 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
if __name__ == "__main__":
|
76 |
iface.launch()
|
|
|
70 |
return "examples/Scenes.From.A.Marriage.US.mp4"
|
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 |
+
analyze_button = gr.Button("Analyze")
|
80 |
+
with gr.Column(scale=1):
|
81 |
+
gr.Markdown("Example Video")
|
82 |
+
example_video = gr.Video("examples/Scenes.From.A.Marriage.US.mp4", label="Example Video")
|
83 |
+
use_example_button = gr.Button("Use Example Video")
|
84 |
+
|
85 |
+
# Create placeholder components for output
|
86 |
+
with gr.Column() as output_container:
|
87 |
+
transcript_output = gr.Textbox(label="Transcript", lines=10, visible=False)
|
88 |
+
speaker_outputs = []
|
89 |
+
for i in range(1, 4): # Assuming a maximum of 3 speakers
|
90 |
+
with gr.Column(visible=False) as speaker_column:
|
91 |
+
speaker_header = gr.Markdown(f"## Speaker {i}")
|
92 |
+
speaker_impression = gr.Textbox(label="General Impression", lines=3)
|
93 |
+
speaker_attachment = gr.Plot(label="Attachment Styles")
|
94 |
+
speaker_attachment_exp = gr.Textbox(label="Attachment Styles Explanation")
|
95 |
+
speaker_dimensions = gr.Plot(label="Attachment Dimensions")
|
96 |
+
speaker_bigfive = gr.Plot(label="Big Five Traits")
|
97 |
+
speaker_bigfive_exp = gr.Textbox(label="Big Five Traits Explanation")
|
98 |
+
speaker_personality = gr.Plot(label="Personality Disorders")
|
99 |
+
speaker_personality_exp = gr.Textbox(label="Personality Disorders Explanation")
|
100 |
+
speaker_outputs.extend([
|
101 |
+
speaker_header, speaker_impression, speaker_attachment, speaker_attachment_exp,
|
102 |
+
speaker_dimensions, speaker_bigfive, speaker_bigfive_exp, speaker_personality,
|
103 |
+
speaker_personality_exp
|
104 |
+
])
|
105 |
+
execution_info = gr.Textbox(label="Execution Information", visible=True)
|
106 |
+
|
107 |
+
all_outputs = [transcript_output] + speaker_outputs + [execution_info]
|
108 |
+
|
109 |
+
analyze_button.click(
|
110 |
+
fn=analyze_video,
|
111 |
+
inputs=[video_input],
|
112 |
+
outputs=all_outputs,
|
113 |
+
show_progress=True
|
114 |
+
).then(
|
115 |
+
fn=update_output,
|
116 |
+
inputs=all_outputs,
|
117 |
+
outputs=all_outputs
|
118 |
+
)
|
119 |
+
|
120 |
+
use_example_button.click(
|
121 |
+
fn=use_example,
|
122 |
+
inputs=[],
|
123 |
+
outputs=[video_input],
|
124 |
+
).then(
|
125 |
+
fn=analyze_video,
|
126 |
+
inputs=[video_input],
|
127 |
+
outputs=all_outputs,
|
128 |
+
show_progress=True
|
129 |
+
).then(
|
130 |
+
fn=update_output,
|
131 |
+
inputs=all_outputs,
|
132 |
+
outputs=all_outputs
|
133 |
+
)
|
134 |
|
135 |
if __name__ == "__main__":
|
136 |
iface.launch()
|