reab5555 commited on
Commit
29e6934
·
verified ·
1 Parent(s): aea77a0

Update app.py

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