reab5555 commited on
Commit
a08a46f
·
verified ·
1 Parent(s): c09e69a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -18
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import gradio as gr
2
  from llm_loader import load_model
3
  from processing import process_input
@@ -67,28 +69,22 @@ def analyze_video(video_path, language_display_name, max_speakers, progress=gr.P
67
  output_components.append(gr.Markdown(f"### {speaker_id}"))
68
 
69
  if "attachment" in speaker_charts:
70
- output_components.extend([
71
- gr.Plot(speaker_charts["attachment"]),
72
- gr.Textbox(value=speaker_explanations.get("attachment", ""),
73
- label=f"Attachment Styles Explanation - {speaker_id}", lines=2),
74
- ])
75
 
76
  if "dimensions" in speaker_charts:
77
  output_components.append(gr.Plot(speaker_charts["dimensions"]))
78
 
79
  if "bigfive" in speaker_charts:
80
- output_components.extend([
81
- gr.Plot(speaker_charts["bigfive"]),
82
- gr.Textbox(value=speaker_explanations.get("bigfive", ""),
83
- label=f"Big Five Traits Explanation - {speaker_id}", lines=2),
84
- ])
85
 
86
  if "personality" in speaker_charts:
87
- output_components.extend([
88
- gr.Plot(speaker_charts["personality"]),
89
- gr.Textbox(value=speaker_explanations.get("personality", ""),
90
- label=f"Personality Disorders Explanation - {speaker_id}", lines=2),
91
- ])
92
 
93
  # Add the transcript at the end
94
  output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10))
@@ -106,8 +102,8 @@ with gr.Blocks() as iface:
106
 
107
  analyze_button = gr.Button("Analyze")
108
 
109
- # Create a container for dynamic outputs
110
- output_container = gr.Column()
111
 
112
  # Execution time box
113
  execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
@@ -115,7 +111,7 @@ with gr.Blocks() as iface:
115
  analyze_button.click(
116
  fn=analyze_video,
117
  inputs=[video_input, language_input, max_speakers],
118
- outputs=[output_container, execution_info_box],
119
  show_progress=True
120
  )
121
 
 
1
+ # app.py
2
+
3
  import gradio as gr
4
  from llm_loader import load_model
5
  from processing import process_input
 
69
  output_components.append(gr.Markdown(f"### {speaker_id}"))
70
 
71
  if "attachment" in speaker_charts:
72
+ output_components.append(gr.Plot(speaker_charts["attachment"]))
73
+ output_components.append(gr.Textbox(value=speaker_explanations.get("attachment", ""),
74
+ label=f"Attachment Styles Explanation - {speaker_id}", lines=2))
 
 
75
 
76
  if "dimensions" in speaker_charts:
77
  output_components.append(gr.Plot(speaker_charts["dimensions"]))
78
 
79
  if "bigfive" in speaker_charts:
80
+ output_components.append(gr.Plot(speaker_charts["bigfive"]))
81
+ output_components.append(gr.Textbox(value=speaker_explanations.get("bigfive", ""),
82
+ label=f"Big Five Traits Explanation - {speaker_id}", lines=2))
 
 
83
 
84
  if "personality" in speaker_charts:
85
+ output_components.append(gr.Plot(speaker_charts["personality"]))
86
+ output_components.append(gr.Textbox(value=speaker_explanations.get("personality", ""),
87
+ label=f"Personality Disorders Explanation - {speaker_id}", lines=2))
 
 
88
 
89
  # Add the transcript at the end
90
  output_components.append(gr.Textbox(value=transcription, label="Transcript", lines=10))
 
102
 
103
  analyze_button = gr.Button("Analyze")
104
 
105
+ # Create placeholders for output components
106
+ output_components = [gr.Markdown(visible=False) for _ in range(50)] # Adjust the number based on your maximum possible outputs
107
 
108
  # Execution time box
109
  execution_info_box = gr.Textbox(label="Execution Information", value="Waiting for analysis...", lines=2)
 
111
  analyze_button.click(
112
  fn=analyze_video,
113
  inputs=[video_input, language_input, max_speakers],
114
+ outputs=output_components + [execution_info_box],
115
  show_progress=True
116
  )
117