Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,7 @@ import time
|
|
16 |
from langdetect import detect
|
17 |
import plotly.graph_objs as go
|
18 |
import re
|
|
|
19 |
|
20 |
# Set environment variable to disable tokenizers parallelism warning
|
21 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
@@ -264,7 +265,13 @@ def update_visibility_and_charts(status, exec_time, lang, info, attachments, big
|
|
264 |
speakers_data = extract_speaker_data(analysis_text)
|
265 |
if not speakers_data:
|
266 |
print(f"No speaker data extracted from: {analysis_text}")
|
267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
attachment_data = {k: v for k, v in data.items() if k in ["Secured", "Anxious-Preoccupied", "Dismissive-Avoidant", "Fearful-Avoidant"]}
|
269 |
if attachment_data:
|
270 |
charts.append(create_bar_chart(attachment_data, "Attachment Styles", speaker))
|
@@ -337,4 +344,4 @@ def create_interface():
|
|
337 |
iface = create_interface()
|
338 |
|
339 |
# Launch the app
|
340 |
-
iface.launch()
|
|
|
16 |
from langdetect import detect
|
17 |
import plotly.graph_objs as go
|
18 |
import re
|
19 |
+
from collections import Counter
|
20 |
|
21 |
# Set environment variable to disable tokenizers parallelism warning
|
22 |
os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
|
265 |
speakers_data = extract_speaker_data(analysis_text)
|
266 |
if not speakers_data:
|
267 |
print(f"No speaker data extracted from: {analysis_text}")
|
268 |
+
|
269 |
+
# Determine the two main speakers
|
270 |
+
speaker_counts = Counter(speakers_data.keys())
|
271 |
+
main_speakers = [speaker for speaker, count in speaker_counts.most_common(2)]
|
272 |
+
|
273 |
+
for speaker in main_speakers:
|
274 |
+
data = speakers_data.get(speaker, {})
|
275 |
attachment_data = {k: v for k, v in data.items() if k in ["Secured", "Anxious-Preoccupied", "Dismissive-Avoidant", "Fearful-Avoidant"]}
|
276 |
if attachment_data:
|
277 |
charts.append(create_bar_chart(attachment_data, "Attachment Styles", speaker))
|
|
|
344 |
iface = create_interface()
|
345 |
|
346 |
# Launch the app
|
347 |
+
iface.launch()
|