Divyansh Kushwaha
commited on
Commit
·
1364bb1
1
Parent(s):
3988f69
app.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
pipe = pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis",device=1)
|
| 5 |
# Streamlit UI
|
| 6 |
-
st.title("Sentiment
|
| 7 |
st.write("Enter your message below:")
|
| 8 |
|
| 9 |
user_input = st.text_input("You:", "")
|
|
@@ -12,5 +14,6 @@ if st.button("Submit") and user_input:
|
|
| 12 |
response = pipe(user_input)[0]
|
| 13 |
label = response['label']
|
| 14 |
score = response['score']
|
| 15 |
-
|
| 16 |
-
st.
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Load sentiment analysis pipeline
|
| 5 |
+
pipe = pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis", device=1)
|
| 6 |
|
|
|
|
| 7 |
# Streamlit UI
|
| 8 |
+
st.title("Sentiment Analyzer")
|
| 9 |
st.write("Enter your message below:")
|
| 10 |
|
| 11 |
user_input = st.text_input("You:", "")
|
|
|
|
| 14 |
response = pipe(user_input)[0]
|
| 15 |
label = response['label']
|
| 16 |
score = response['score']
|
| 17 |
+
|
| 18 |
+
st.write(f"**Label:** {label}")
|
| 19 |
+
st.write(f"**Score:** {score:.4f}")
|