Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
def main():
|
| 4 |
-
sentiment_pipeline = pipeline(model="microsoft/resnet-50")
|
| 5 |
st.title("Sentiment Analysis with HuggingFace Spaces")
|
| 6 |
st.write("Enter a sentence to analyze its sentiment:")
|
| 7 |
user_input = st.text_input("")
|
| 8 |
if user_input:
|
| 9 |
result = sentiment_pipeline(user_input)
|
| 10 |
-
sentiment = result[
|
| 11 |
-
confidence = result[
|
| 12 |
|
| 13 |
st.write(f"Sentiment: {sentiment}")
|
| 14 |
st.write(f"Confidence: {confidence:.2f}")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
def main():
|
| 4 |
+
sentiment_pipeline = pipeline("sentiment-analysis",model="microsoft/resnet-50")
|
| 5 |
st.title("Sentiment Analysis with HuggingFace Spaces")
|
| 6 |
st.write("Enter a sentence to analyze its sentiment:")
|
| 7 |
user_input = st.text_input("")
|
| 8 |
if user_input:
|
| 9 |
result = sentiment_pipeline(user_input)
|
| 10 |
+
sentiment = result["label"]
|
| 11 |
+
confidence = result["score"]
|
| 12 |
|
| 13 |
st.write(f"Sentiment: {sentiment}")
|
| 14 |
st.write(f"Confidence: {confidence:.2f}")
|