Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,8 @@ st.markdown("""
|
|
| 43 |
""", unsafe_allow_html=True)
|
| 44 |
|
| 45 |
# Load model
|
| 46 |
-
|
|
|
|
| 47 |
|
| 48 |
names = ["neutral", "positive", "negative"]
|
| 49 |
emojis = {"positive": "π€", "negative": "π", "neutral": "π"}
|
|
@@ -90,9 +91,8 @@ if st.button("π Predict Sentiment"):
|
|
| 90 |
if not is_mostly_hindi(cleaned_input):
|
| 91 |
st.error("β Input should be primarily in Hindi (Devanagari script).")
|
| 92 |
else:
|
| 93 |
-
result = pipe(cleaned_input)[0]
|
| 94 |
-
|
| 95 |
-
sentiment = names[sentiment_index]
|
| 96 |
emoji = emojis[sentiment]
|
| 97 |
|
| 98 |
st.markdown(f"<div class='sentiment-result'>β
Sentiment: <b>{sentiment.capitalize()} {emoji}</b></div>", unsafe_allow_html=True)
|
|
|
|
| 43 |
""", unsafe_allow_html=True)
|
| 44 |
|
| 45 |
# Load model
|
| 46 |
+
|
| 47 |
+
pipe = pipeline("text-classification", model="NeonSamurai/hindi_sentiment_bert_finetuned")
|
| 48 |
|
| 49 |
names = ["neutral", "positive", "negative"]
|
| 50 |
emojis = {"positive": "π€", "negative": "π", "neutral": "π"}
|
|
|
|
| 91 |
if not is_mostly_hindi(cleaned_input):
|
| 92 |
st.error("β Input should be primarily in Hindi (Devanagari script).")
|
| 93 |
else:
|
| 94 |
+
result = int(pipe(cleaned_input)[0]['label'].split("_")[1])
|
| 95 |
+
sentiment = names[result]
|
|
|
|
| 96 |
emoji = emojis[sentiment]
|
| 97 |
|
| 98 |
st.markdown(f"<div class='sentiment-result'>β
Sentiment: <b>{sentiment.capitalize()} {emoji}</b></div>", unsafe_allow_html=True)
|