reab5555 commited on
Commit
646f3d2
·
verified ·
1 Parent(s): 6b7a118

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -20
app.py CHANGED
@@ -41,23 +41,26 @@ def analyze_video(video_path, max_speakers, progress=gr.Progress()):
41
  for speaker_id, speaker_charts in charts.items():
42
  speaker_explanations = explanations[speaker_id]
43
 
44
- speaker_content = gr.Column([
45
- gr.Plot(value=speaker_charts.get("attachment", None), visible=True),
46
- gr.Textbox(value=speaker_explanations.get("attachment", ""), label="Attachment Styles Explanation", visible=True),
47
- gr.Plot(value=speaker_charts.get("dimensions", None), visible=True),
48
- gr.Plot(value=speaker_charts.get("bigfive", None), visible=True),
49
- gr.Textbox(value=speaker_explanations.get("bigfive", ""), label="Big Five Traits Explanation", visible=True),
50
- gr.Plot(value=speaker_charts.get("personality", None), visible=True),
51
- gr.Textbox(value=speaker_explanations.get("personality", ""), label="Personality Disorders Explanation", visible=True),
52
- ])
53
-
54
- tabs.append(gr.TabItem(label=speaker_id, content=speaker_content))
 
 
 
55
 
56
  # Add the transcript and execution time
57
  transcript_box = gr.Textbox(value=transcription, label="Transcript", lines=10, visible=True)
58
  execution_time_box = gr.Textbox(value=f"Completed in {int(execution_time)} seconds.", label="Execution Information", visible=True)
59
 
60
- return gr.Tabs(tabs), transcript_box, execution_time_box
61
 
62
  # Define the Gradio interface
63
  with gr.Blocks() as iface:
@@ -69,15 +72,15 @@ with gr.Blocks() as iface:
69
 
70
  analyze_button = gr.Button("Analyze")
71
 
 
 
72
  # Create placeholders for output components
73
- with gr.Row():
74
- execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
75
- analyze_button.click(
76
- fn=analyze_video,
77
- inputs=[video_input, max_speakers],
78
- outputs=[gr.Tabs(), gr.Textbox(label="Transcript", lines=10), execution_info_box],
79
- show_progress=True
80
- )
81
 
82
  # Launch the app
83
  if __name__ == "__main__":
 
41
  for speaker_id, speaker_charts in charts.items():
42
  speaker_explanations = explanations[speaker_id]
43
 
44
+ speaker_tab = gr.TabItem(label=speaker_id)
45
+ with speaker_tab:
46
+ gr.Markdown(f"### {speaker_id}", visible=True)
47
+ gr.Plot(value=speaker_charts.get("attachment", None), visible=True)
48
+ gr.Textbox(value=speaker_explanations.get("attachment", ""), label="Attachment Styles Explanation", visible=True)
49
+ gr.Plot(value=speaker_charts.get("dimensions", None), visible=True)
50
+ gr.Plot(value=speaker_charts.get("bigfive", None), visible=True)
51
+ gr.Textbox(value=speaker_explanations.get("bigfive", ""), label="Big Five Traits Explanation", visible=True)
52
+ gr.Plot(value=speaker_charts.get("personality", None), visible=True)
53
+ gr.Textbox(value=speaker_explanations.get("personality", ""), label="Personality Disorders Explanation", visible=True)
54
+
55
+ tabs.append(speaker_tab)
56
+
57
+ tabs_component = gr.Tabs(tabs)
58
 
59
  # Add the transcript and execution time
60
  transcript_box = gr.Textbox(value=transcription, label="Transcript", lines=10, visible=True)
61
  execution_time_box = gr.Textbox(value=f"Completed in {int(execution_time)} seconds.", label="Execution Information", visible=True)
62
 
63
+ return tabs_component, transcript_box, execution_time_box
64
 
65
  # Define the Gradio interface
66
  with gr.Blocks() as iface:
 
72
 
73
  analyze_button = gr.Button("Analyze")
74
 
75
+ execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
76
+
77
  # Create placeholders for output components
78
+ analyze_button.click(
79
+ fn=analyze_video,
80
+ inputs=[video_input, max_speakers],
81
+ outputs=[gr.Tabs(), gr.Textbox(label="Transcript", lines=10), execution_info_box],
82
+ show_progress=True
83
+ )
 
 
84
 
85
  # Launch the app
86
  if __name__ == "__main__":