Spaces:
Sleeping
Sleeping
Vargock
commited on
Commit
·
bb02a23
1
Parent(s):
386ee45
app.py
CHANGED
|
@@ -24,11 +24,11 @@ def index():
|
|
| 24 |
if request.method == "POST":
|
| 25 |
text = request.form.get("text", "").strip()
|
| 26 |
if text:
|
| 27 |
-
user_id = 1
|
| 28 |
lang = detect_lang(text)
|
| 29 |
labels = LABELS[lang]
|
| 30 |
|
| 31 |
-
#
|
| 32 |
sentiment_model = MODELS["ru_sentiment"] if lang == "ru" else MODELS["en_sentiment"]
|
| 33 |
sentiment_data = hf_infer(sentiment_model, text)
|
| 34 |
sentiment_result = None
|
|
@@ -46,7 +46,7 @@ def index():
|
|
| 46 |
|
| 47 |
pos_count = update_history(user_id, sentiment_result["name"] if sentiment_result else "")
|
| 48 |
|
| 49 |
-
#
|
| 50 |
emotion_result = None
|
| 51 |
if lang == "en":
|
| 52 |
emo_data = hf_infer(MODELS["emotion"], text)
|
|
@@ -59,7 +59,7 @@ def index():
|
|
| 59 |
"color": COLOR_MAP["Emotion"]
|
| 60 |
}
|
| 61 |
|
| 62 |
-
#
|
| 63 |
tox_result = None
|
| 64 |
if lang == "en":
|
| 65 |
tox_data = hf_infer(MODELS["toxicity"], text)
|
|
|
|
| 24 |
if request.method == "POST":
|
| 25 |
text = request.form.get("text", "").strip()
|
| 26 |
if text:
|
| 27 |
+
user_id = 1
|
| 28 |
lang = detect_lang(text)
|
| 29 |
labels = LABELS[lang]
|
| 30 |
|
| 31 |
+
# Sentiment
|
| 32 |
sentiment_model = MODELS["ru_sentiment"] if lang == "ru" else MODELS["en_sentiment"]
|
| 33 |
sentiment_data = hf_infer(sentiment_model, text)
|
| 34 |
sentiment_result = None
|
|
|
|
| 46 |
|
| 47 |
pos_count = update_history(user_id, sentiment_result["name"] if sentiment_result else "")
|
| 48 |
|
| 49 |
+
# Emotion (EN only)
|
| 50 |
emotion_result = None
|
| 51 |
if lang == "en":
|
| 52 |
emo_data = hf_infer(MODELS["emotion"], text)
|
|
|
|
| 59 |
"color": COLOR_MAP["Emotion"]
|
| 60 |
}
|
| 61 |
|
| 62 |
+
# Toxicity (EN only)
|
| 63 |
tox_result = None
|
| 64 |
if lang == "en":
|
| 65 |
tox_data = hf_infer(MODELS["toxicity"], text)
|