Orawan commited on
Commit
f8e4306
·
1 Parent(s): e1d3d2b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -19
app.py CHANGED
@@ -10,22 +10,3 @@ nlp = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
10
 
11
  st.title("Sentiment Analysis App")
12
  user_input = st.text_input("ป้อนประโยคเพื่อวิเคราะห์ความรู้สึก:")
13
- if user_input:
14
- result = nlp(user_input)
15
- sentiment_label = result[0]["label"]
16
- sentiment_score = result[0]["score"]
17
-
18
- # Define explanations for sentiment labels
19
- sentiment_explanations = {
20
- "LABEL_0": "Very negative",
21
- "LABEL_1": "Negative",
22
- "LABEL_2": "Neutral",
23
- "LABEL_3": "Positive",
24
- "LABEL_4": "Very positive"
25
- }
26
-
27
- # Get the explanation for the sentiment label
28
- sentiment_explanation = sentiment_explanations.get(sentiment_label, "Unknown")
29
-
30
- st.write(f"Sentiment: {sentiment_explanation}")
31
- st.write(f"Confidence: {sentiment_score:.4f}")
 
10
 
11
  st.title("Sentiment Analysis App")
12
  user_input = st.text_input("ป้อนประโยคเพื่อวิเคราะห์ความรู้สึก:")