Spaces:
Runtime error
Runtime error
Upload 2 files
Browse files- .gitattributes +1 -0
- app_senti_65130700324.py +37 -0
- imdb_reviews.csv +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
imdb_reviews.csv filter=lfs diff=lfs merge=lfs -text
|
app_senti_65130700324.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
import streamlit as st
|
| 4 |
+
from transformers import pipeline
|
| 5 |
+
|
| 6 |
+
# Load the sentiment analysis model
|
| 7 |
+
model_name = "poom-sci/WangchanBERTa-finetuned-sentiment"
|
| 8 |
+
sentiment_analyzer = pipeline('sentiment-analysis', model=model_name)
|
| 9 |
+
|
| 10 |
+
# Streamlit app
|
| 11 |
+
st.title("Thai Sentiment Analysis App")
|
| 12 |
+
|
| 13 |
+
# Input text
|
| 14 |
+
text_input = st.text_area("Enter Thai text for sentiment analysis", "ขอความเห็นหน่อย... ")
|
| 15 |
+
|
| 16 |
+
# Button to trigger analysis
|
| 17 |
+
if st.button("Analyze Sentiment"):
|
| 18 |
+
# Analyze sentiment using the model
|
| 19 |
+
results = sentiment_analyzer([text_input])
|
| 20 |
+
|
| 21 |
+
# Extract sentiment and score
|
| 22 |
+
sentiment = results[0]['label']
|
| 23 |
+
score = results[0]['score']
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Display result as progress bars
|
| 27 |
+
st.subheader("Sentiment Analysis Result:")
|
| 28 |
+
|
| 29 |
+
if sentiment == 'pos':
|
| 30 |
+
st.success(f"Positive Sentiment (Score: {score:.2f})")
|
| 31 |
+
st.progress(score)
|
| 32 |
+
elif sentiment == 'neg':
|
| 33 |
+
st.error(f"Negative Sentiment (Score: {score:.2f})")
|
| 34 |
+
st.progress(score)
|
| 35 |
+
else:
|
| 36 |
+
st.warning(f"Neutral Sentiment (Score: {score:.2f})")
|
| 37 |
+
st.progress(score)
|
imdb_reviews.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:94752f1d468e32222c9190c99dc1758a2e81ec6ad5e76528fe4ce31d3edd495c
|
| 3 |
+
size 66262304
|