NeonSamurai commited on
Commit
5cdfd0f
Β·
verified Β·
1 Parent(s): 49abf62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -43,7 +43,8 @@ st.markdown("""
43
  """, unsafe_allow_html=True)
44
 
45
  # Load model
46
- pipe = pipeline("text-classification", model="NeonSamurai/hindi_bert_model")
 
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
- sentiment_index = int(result['label'].split("_")[1])
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)