Spaces:
Runtime error
Runtime error
Update app.py
Browse files17 unmodified lines1819202122232425262728293031323334353637383940414298 unmodified lines14114214314414514614714814917 unmodified linesfont_path = os.path.join(current_dir, "ArabicR2013-J25x.ttf")ARABIC_STOP_WORDS = {'ูู', 'ู ู', 'ุฅูู', 'ุนูู', 'ุนู', 'ู ุน', 'ุฎูุงู', 'ุญุชู', 'ุฅุฐุง', 'ุซู ','ุฃู', 'ู', 'ู', 'ู', 'ุจ', 'ู', 'ูู', 'ุงู', 'ูุฐุง', 'ูุฐู', 'ุฐูู','ุชูู', 'ูุคูุงุก', 'ูู ', 'ูู', 'ูู', 'ูู', 'ูุญู', 'ุงูุช', 'ุงูุชู ','ูุงู', 'ูุงูุช', 'ูููู', 'ุชููู', 'ุงู', 'ูู', 'ุจุนุถ', 'ุบูุฑ', 'ุญูู','ุนูุฏ', 'ูุฏ', 'ููุฏ', 'ูู ', 'ูู', 'ูู', 'ู ุง', 'ู ุงุฐุง', 'ู ุชู', 'ููู','ุงูู', 'ูู ุงุฐุง', 'ุงูุฐู', 'ุงูุชู', 'ุงูุฐูู', 'ุงููุงุชู', 'ุงูููุงุชู','ุงูุงู', 'ุจูู', 'ููู', 'ุชุญุช', 'ุงู ุงู ', 'ุฎูู', 'ุญูู', 'ูุจู', 'ุจุนุฏ','ู', 'ุฃู', 'ูู', 'ูู', 'ูู ', 'ูู', 'ูู', 'ู ู', 'ูู', 'ูู','ูู ุง', 'ููุง', 'ู ูุฐ', 'ููุฏ', 'ููุง', 'ููุณ', 'ููู ', 'ุญูุซ', 'ููุงู','ุฌุฏุง', 'ุฐุงุช', 'ุถู ู', 'ุงูู', 'ูุฏู', 'ุนููู', 'ู ุซู', 'ููู', 'ุนูุฏ','ุฃู ุง', 'ูุฐู', 'ูุฃู', 'ููู', 'ููุงู', 'ูุฏู', 'ููุงู', 'ููู', 'ููู','ููู', 'ุชูู', 'ููู ', 'ููู', 'ููู', 'ููู', 'ูููุฏ', 'ูู ู', 'ููุฐุง','ุงูู', 'ุถู ู', 'ุงููุง', 'ุฌู ูุน', 'ุงูุฐู', 'ูุจู', 'ุจุนุฏ', 'ุญูู', 'ุงูุถุง','ูุงุฒู ', 'ุนูู', 'ูุฌุจ', 'ุตุงุฑ', 'ุตุงุฑุช', 'ุชุญุช', 'ุถุฏ','ูุง', 'ูุง', 'ุงู ุง', 'ุจูุง', 'ุงู', 'ุจู', 'ุงูู', 'ูู ุง','ุงูุง', 'ุงููู', 'ูู', 'ูู', 'ุงู', 'ููุช'}COUNTRY_MAPPING = {'ู ุตุฑ': 'Egypt','ุงูุณุนูุฏูุฉ': 'Saudi Arabia',98 unmodified linesfor summary in summaries:country_en = COUNTRY_MAPPING.get(summary['country'])if country_en and country_en in coordinates:# Get dominant sentimentdominant_emotion = summary['top_emotions'][0]['emotion'] if summary['top_emotions'] else "Neutral"circle_color = sentiment_colors.get(dominant_emotion, 'gray')# Create popup contentpopup_content = f"""17 unmodified lines181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727398 unmodified lines17217317417517617717817918018118218318418518618718817 unmodified linesfont_path = os.path.join(current_dir, "ArabicR2013-J25x.ttf")ARABIC_STOP_WORDS = {ARABIC_STOP_WORDS = {# First group'ูู', 'ู ู', 'ุฅูู', 'ุนูู', 'ุนูู', 'ุนู', 'ู ุน', 'ุฎูุงู', 'ุญุชู', 'ุญุชู', 'ุฅุฐุง',# Middle group'ุซู ', 'ุฃู', 'ู', 'ู', 'ุจ', 'ู', 'ูู', 'ุงู', 'ูุฐุง','ูุฐู', 'ุฐูู', 'ุชูู', 'ูุคูุงุก', 'ูู ', 'ูู', 'ูู', 'ูู', 'ูุญู','ุงูุช', 'ุงูุชู ', 'ูุงู', 'ูุงูุช', 'ูููู', 'ุชููู', 'ุงู', 'ูู','ุจุนุถ', 'ุบูุฑ', 'ุญูู', 'ุนูุฏ', 'ูุฏ', 'ููุฏ', 'ูู ', 'ูู', 'ูู','ู ุง', 'ู ุงุฐุง', 'ู ุชู', 'ููู', 'ุงูู', 'ูู ุงุฐุง', 'ุงูุฐู', 'ุงูุชู','ุงูุฐูู', 'ุงููุงุชู', 'ุงูููุงุชู', 'ุงูุงู', 'ุจูู', 'ููู', 'ุชุญุช','ุงู ุงู ', 'ุฎูู', 'ุญูู', 'ูุจู', 'ุจุนุฏ', 'ุฃู', 'ูู', 'ูู ุง', 'ููุง','ู ูุฐ', 'ููุณ', 'ุญูุซ', 'ููุงู', 'ุฌุฏุง', 'ุฐุงุช', 'ุถู ู', 'ุงูู', 'ูุฏู','ุนููู', 'ู ุซู', 'ุฃู ุง', 'ูุฏู', 'ููู', 'ููู ', 'ููู', 'ุงูุถุง', 'ูุงุฒู ','ูุฌุจ', 'ุตุงุฑ', 'ุตุงุฑุช', 'ุถุฏ', 'ูุง', 'ูุง', 'ุงู ุง','ุจูุง', 'ุงู', 'ุจู', 'ุงูู', 'ูู ุง', 'ุงูุง', 'ุงููู', 'ูู', 'ูู', 'ููุช',# Middle group prefixed with "ู"'ูุซู ', 'ูุฃู', 'ูู', 'ูุจ', 'ูู', 'ููู', 'ูุงู','ููุฐุง', 'ููุฐู', 'ูุฐูู', 'ูุชูู', 'ููุคูุงุก', 'ููู ', 'ููู', 'ููู', 'ููู', 'ููุญู','ูุงูุช', 'ูุงูุชู ', 'ููุงู', 'ููุงูุช', 'ููููู', 'ูุชููู', 'ูุงู', 'ููู','ูุจุนุถ', 'ูุบูุฑ', 'ูุญูู', 'ูุนูุฏ', 'ููุฏ', 'ูููุฏ', 'ููู ', 'ููู', 'ููู','ูู ุง', 'ูู ุงุฐุง', 'ูู ุชู', 'ูููู', 'ูุงูู', 'ููู ุงุฐุง', 'ูุงูุฐู', 'ูุงูุชู','ูุงูุฐูู', 'ูุงููุงุชู', 'ูุงูููุงุชู', 'ูุงูุงู', 'ูุจูู', 'ูููู', 'ูุชุญุช','ูุงู ุงู ', 'ูุฎูู', 'ูุญูู', 'ููุจู', 'ูุจุนุฏ', 'ูุฃู', 'ููู', 'ููู ุง', 'ูููุง','ูู ูุฐ', 'ูููุณ', 'ูุญูุซ', 'ูููุงู', 'ูุฌุฏุง', 'ูุฐุงุช', 'ูุถู ู', 'ูุงูู', 'ููุฏู','ูุนููู', 'ูู ุซู', 'ูุฃู ุง', 'ูููู', 'ูููู ', 'ูููู', 'ูุงูุถุง', 'ููุงุฒู ','ููุฌุจ', 'ูุตุงุฑ', 'ูุตุงุฑุช', 'ูุถุฏ', 'ููุง', 'ููุง', 'ูุงู ุง','ูุจูุง', 'ูุงู', 'ูุจู', 'ูุงูู', 'ููู ุง', 'ูุงูุง', 'ูุงููู', 'ููู', 'ููู', 'ูููุช',# Last group'ููู', 'ูู ู', 'ูุนูู', 'ูุนูู', 'ูุนู', 'ูู ุน', 'ูุญุชู', 'ูุฅุฐุง','ููุฐุง', 'ููุฐู', 'ูุฐูู', 'ูุชูู', 'ููู', 'ููู', 'ููุญู','ููุงู', 'ููุงูุช', 'ููู', 'ูุจุนุถ', 'ูุญูู', 'ูุนูุฏ', 'ููุฏ','ูููุฏ', 'ููู ', 'ููู', 'ูู ุง', 'ูููู', 'ูุงูู', 'ูุงูุฐู','ูุจูู', 'ููุจู', 'ูุจุนุฏ', 'ููู', 'ูููุง', 'ูููุงู', 'ูุงูู','ููุฏู', 'ูุนููู', 'ูู ุซู',# Arabic numbers'ูุงุญุฏ', 'ุงุซูุงู', 'ุซูุงุซุฉ', 'ุฃุฑุจุนุฉ', 'ุฎู ุณุฉ', 'ุณุชุฉ', 'ุณุจุนุฉ','ุซู ุงููุฉ', 'ุชุณุนุฉ', 'ุนุดุฑุฉ',# Arabic ordinals'ุงูุฃูู', 'ุงูุซุงูู', 'ุงูุซุงูุซ', 'ุงูุฑุงุจุน', 'ุงูุฎุงู ุณ', 'ุงูุณุงุฏุณ','ุงูุณุงุจุน', 'ุงูุซุงู ู', 'ุงูุชุงุณุน', 'ุงูุนุงุดุฑ'}COUNTRY_MAPPING = {'ู ุตุฑ': 'Egypt','ุงูุณุนูุฏูุฉ': 'Saudi Arabia',98 unmodified linesfor summary in summaries:country_en = COUNTRY_MAPPING.get(summary['country'])if country_en and country_en in coordinates:# Mapping emotions back to their original labelsREVERSE_EMOTION_LABELS = {'Negative': 'LABEL_0','Positive': 'LABEL_1','Neutral': 'LABEL_2'}# Get dominant sentiment and map it back to original labeldominant_emotion = summary['top_emotions'][0]['emotion'] if summary['top_emotions'] else "Neutral"dominant_label = REVERSE_EMOTION_LABELS.get(dominant_emotion, 'LABEL_2')circle_color = sentiment_colors.get(dominant_label, 'gray')# Create popup contentpopup_content = f"""
app.py+57-18