Spaces:
Runtime error
Runtime error
joulammous
commited on
Commit
•
f6d3905
1
Parent(s):
72f2af1
Delete app.py
Browse files
app.py
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
|
2 |
-
# Libraries
|
3 |
-
|
4 |
-
import streamlit as st
|
5 |
-
import tensorflow as tf
|
6 |
-
from transformers import pipeline
|
7 |
-
|
8 |
-
# Milestone 2
|
9 |
-
|
10 |
-
# select a pretrained model
|
11 |
-
sentiment_pipeline = pipeline("sentiment-analysis", model = "siebert/sentiment-roberta-large-english")
|
12 |
-
|
13 |
-
# intro
|
14 |
-
st.title("Sentiment Analysis App")
|
15 |
-
st.write("Enter some text and I'll predict its sentiment!")
|
16 |
-
|
17 |
-
# add a text input box
|
18 |
-
text_input = st.text_input("Enter your text here:", value = "The weather is nice today.")
|
19 |
-
|
20 |
-
# run the model when the user clicks submit
|
21 |
-
if st.button("Submit"):
|
22 |
-
|
23 |
-
# get result
|
24 |
-
sentiment = sentiment_pipeline(text_input)
|
25 |
-
|
26 |
-
# split into sentiment and score
|
27 |
-
sen = sentiment[0]['label']
|
28 |
-
score = round(sentiment[0]['score'], 4)
|
29 |
-
|
30 |
-
# display the prediction
|
31 |
-
st.write(f"Sentiment: {sen} , Confidence Score: {score}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|