0llheaven commited on
Commit
94f15b2
·
verified ·
1 Parent(s): c6f7fa8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -9,9 +9,14 @@ model = AutoModelForSequenceClassification.from_pretrained(model_demo, num_label
9
  # สร้างโมเดลสำหรับ Sentiment Analysis
10
  sentiment_analyzer = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
11
 
 
 
 
12
  st.title('Sentiment Analysis App')
13
 
14
  text = st.text_area('Enter text to analyze:')
15
  if st.button('Analyze'):
16
  result = sentiment_analyzer(text)
 
 
17
  st.write(result)
 
9
  # สร้างโมเดลสำหรับ Sentiment Analysis
10
  sentiment_analyzer = pipeline('sentiment-analysis', model=model, tokenizer=tokenizer)
11
 
12
+ # ทำการเปลี่ยนชื่อ label เพื่อความเข้าใจง่าย
13
+ label_map = {"LABEL_0": "NEGATIVE", "LABEL_1": "POSITIVE"}
14
+
15
  st.title('Sentiment Analysis App')
16
 
17
  text = st.text_area('Enter text to analyze:')
18
  if st.button('Analyze'):
19
  result = sentiment_analyzer(text)
20
+ for res in result:
21
+ res['label'] = label_map[res['label']]
22
  st.write(result)