initial push
Browse files- app.py +16 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
sentiment_pipeline = pipeline("sentiment-analysis")
|
5 |
+
|
6 |
+
st.title("Sentiment Analysis with HuggingFace Spaces")
|
7 |
+
st.write("Enter a sentence to analyze its sentiment:")
|
8 |
+
|
9 |
+
user_input = st.text_input("")
|
10 |
+
if user_input:
|
11 |
+
result = sentiment_pipeline(user_input)
|
12 |
+
sentiment = result[0]["label"]
|
13 |
+
confidence = result[0]["score"]
|
14 |
+
|
15 |
+
st.write(f"Sentiment: {sentiment}")
|
16 |
+
st.write(f"Confidence: {confidence:.2f}")
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
transformers
|
3 |
+
torch
|