Spaces:
Running
Running
Update app.py
Browse filesUpdated with Yoruba
app.py
CHANGED
@@ -23,7 +23,7 @@ def analyze_sentiment(text):
|
|
23 |
confidence = f"{result['score']:.2f}"
|
24 |
return [[sentiment, confidence]]
|
25 |
|
26 |
-
# Example texts in different languages
|
27 |
examples = [
|
28 |
["I absolutely love this new phone, the camera is stunning!"], # English
|
29 |
["Je déteste quand cette application plante sans cesse."], # French
|
@@ -35,12 +35,15 @@ examples = [
|
|
35 |
["هذا الهاتف رائع للغاية، أنا سعيد جدًا به."], # Arabic
|
36 |
["この映画は本当に面白かった!"], # Japanese
|
37 |
["De app werkt prima, maar kan beter."], # Dutch
|
|
|
|
|
|
|
38 |
]
|
39 |
|
40 |
# Gradio UI
|
41 |
demo = gr.Interface(
|
42 |
fn=analyze_sentiment,
|
43 |
-
inputs=gr.Textbox(lines=3, placeholder="Type a sentence here in one of
|
44 |
outputs=gr.Dataframe(
|
45 |
headers=["Emotion (1–5 Stars)", "Confidence"],
|
46 |
row_count=1,
|
@@ -49,8 +52,8 @@ demo = gr.Interface(
|
|
49 |
examples=examples,
|
50 |
title="🌍 Multilingual Emotion & Sentiment Analyzer",
|
51 |
description=(
|
52 |
-
"Supports
|
53 |
-
"Portuguese, Russian, Arabic, Japanese). Detects fine-grained emotions "
|
54 |
"with 5 levels:\n\n"
|
55 |
"😡 Very Negative | ☹️ Negative | 😐 Neutral | 🙂 Positive | 🤩 Very Positive"
|
56 |
),
|
|
|
23 |
confidence = f"{result['score']:.2f}"
|
24 |
return [[sentiment, confidence]]
|
25 |
|
26 |
+
# Example texts in different languages including Yoruba
|
27 |
examples = [
|
28 |
["I absolutely love this new phone, the camera is stunning!"], # English
|
29 |
["Je déteste quand cette application plante sans cesse."], # French
|
|
|
35 |
["هذا الهاتف رائع للغاية، أنا سعيد جدًا به."], # Arabic
|
36 |
["この映画は本当に面白かった!"], # Japanese
|
37 |
["De app werkt prima, maar kan beter."], # Dutch
|
38 |
+
["Mo nifẹ́ fíìmù yìí gan-an!"], # Yoruba Positive
|
39 |
+
["Mo kọ́ láti rí ìrírí tó dáa nínú iṣẹ́ yìí."], # Yoruba Neutral
|
40 |
+
["Mo bínú gan-an sí ìṣẹ̀lẹ̀ náà."], # Yoruba Negative
|
41 |
]
|
42 |
|
43 |
# Gradio UI
|
44 |
demo = gr.Interface(
|
45 |
fn=analyze_sentiment,
|
46 |
+
inputs=gr.Textbox(lines=3, placeholder="Type a sentence here in one of 11+ languages..."),
|
47 |
outputs=gr.Dataframe(
|
48 |
headers=["Emotion (1–5 Stars)", "Confidence"],
|
49 |
row_count=1,
|
|
|
52 |
examples=examples,
|
53 |
title="🌍 Multilingual Emotion & Sentiment Analyzer",
|
54 |
description=(
|
55 |
+
"Supports 11+ languages (English, French, German, Spanish, Italian, Dutch, "
|
56 |
+
"Portuguese, Russian, Arabic, Japanese, Yoruba). Detects fine-grained emotions "
|
57 |
"with 5 levels:\n\n"
|
58 |
"😡 Very Negative | ☹️ Negative | 😐 Neutral | 🙂 Positive | 🤩 Very Positive"
|
59 |
),
|