Spaces:
No application file
No application file
Commit
·
5e5edfa
1
Parent(s):
84f4546
stream_trainer
Browse files- stream_trainer.py +15 -0
stream_trainer.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from textblob import TextBlob
|
3 |
+
|
4 |
+
def analyze_sentiment(text):
|
5 |
+
blob = TextBlob(text)
|
6 |
+
return blob.sentiment.polarity
|
7 |
+
|
8 |
+
st.title("Sentiment Analysis App")
|
9 |
+
file_uploader = st.file_uploader("Upload File", type="txt")
|
10 |
+
if file_uploader:
|
11 |
+
uploaded_file = file_uploader.read()
|
12 |
+
sentiment = analyze_sentiment(uploaded_file)
|
13 |
+
st.write(f"The sentiment score is {sentiment}")
|
14 |
+
else:
|
15 |
+
st.write("Please upload a file.")
|