Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,8 @@ class Config:
|
|
37 |
'zh': 'Chinese',
|
38 |
'es': 'Spanish',
|
39 |
'fr': 'French',
|
40 |
-
'de': 'German'
|
|
|
41 |
}
|
42 |
|
43 |
MODELS = {
|
@@ -396,7 +397,8 @@ def analyze_single_text(text: str, language: str, theme: str, clean_text: bool,
|
|
396 |
'Chinese': 'zh',
|
397 |
'Spanish': 'es',
|
398 |
'French': 'fr',
|
399 |
-
'German': 'de'
|
|
|
400 |
}
|
401 |
language_code = language_map.get(language, 'auto')
|
402 |
|
@@ -485,13 +487,29 @@ def clear_all_history():
|
|
485 |
|
486 |
# Sample data
|
487 |
SAMPLE_TEXTS = [
|
488 |
-
|
489 |
-
["
|
490 |
-
|
491 |
-
|
492 |
-
["
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
493 |
]
|
494 |
|
|
|
495 |
# Gradio Interface
|
496 |
with gr.Blocks(theme=gr.themes.Soft(), title="Advanced Sentiment Analyzer") as demo:
|
497 |
gr.Markdown("# 🎭 Advanced Multilingual Sentiment Analyzer")
|
|
|
37 |
'zh': 'Chinese',
|
38 |
'es': 'Spanish',
|
39 |
'fr': 'French',
|
40 |
+
'de': 'German',
|
41 |
+
'sv': 'Swedish'
|
42 |
}
|
43 |
|
44 |
MODELS = {
|
|
|
397 |
'Chinese': 'zh',
|
398 |
'Spanish': 'es',
|
399 |
'French': 'fr',
|
400 |
+
'German': 'de',
|
401 |
+
'Swedish': 'sv'
|
402 |
}
|
403 |
language_code = language_map.get(language, 'auto')
|
404 |
|
|
|
487 |
|
488 |
# Sample data
|
489 |
SAMPLE_TEXTS = [
|
490 |
+
# Auto Detect
|
491 |
+
["The film had its moments, but overall it felt a bit too long and lacked emotional depth."],
|
492 |
+
|
493 |
+
# English
|
494 |
+
["I was completely blown away by the movie — the performances were raw and powerful, and the story stayed with me long after the credits rolled."],
|
495 |
+
|
496 |
+
# Chinese
|
497 |
+
["这部电影节奏拖沓,剧情老套,完全没有让我产生任何共鸣,是一次失望的观影体验。"],
|
498 |
+
|
499 |
+
# Spanish
|
500 |
+
["Una obra maestra del cine contemporáneo, con actuaciones sobresalientes, un guion bien escrito y una dirección impecable."],
|
501 |
+
|
502 |
+
# French
|
503 |
+
["Je m'attendais à beaucoup mieux. Le scénario était confus, les dialogues ennuyeux, et je me suis presque endormi au milieu du film."],
|
504 |
+
|
505 |
+
# German
|
506 |
+
["Der Film war ein emotionales Erlebnis mit großartigen Bildern, einem mitreißenden Soundtrack und einer Geschichte, die zum Nachdenken anregt."],
|
507 |
+
|
508 |
+
# Swedish
|
509 |
+
["Filmen var en besvikelse – tråkig handling, överdrivet skådespeleri och ett slut som inte gav något avslut alls."]
|
510 |
]
|
511 |
|
512 |
+
|
513 |
# Gradio Interface
|
514 |
with gr.Blocks(theme=gr.themes.Soft(), title="Advanced Sentiment Analyzer") as demo:
|
515 |
gr.Markdown("# 🎭 Advanced Multilingual Sentiment Analyzer")
|