Spaces:
Sleeping
Sleeping
app updated
Browse files
app.py
CHANGED
@@ -5,19 +5,6 @@ import numpy as np
|
|
5 |
from scipy.special import softmax
|
6 |
|
7 |
|
8 |
-
# Define the function for sentiment analysis
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
# # Setting the page configurations
|
14 |
-
# st.set_page_config(
|
15 |
-
# page_title="Sentiment Analysis App",
|
16 |
-
# page_icon=":smile:",
|
17 |
-
# layout="wide",
|
18 |
-
# initial_sidebar_state="auto",
|
19 |
-
# )
|
20 |
-
|
21 |
# Add description and title
|
22 |
st.write("""
|
23 |
# Sentiment Analysis App
|
@@ -53,15 +40,6 @@ h1 {
|
|
53 |
unsafe_allow_html=True
|
54 |
)
|
55 |
|
56 |
-
# Show sentiment output
|
57 |
-
# if text:
|
58 |
-
# sentiment, score = predict_sentiment(text)
|
59 |
-
# if sentiment == "Positive":
|
60 |
-
# st.success(f"The sentiment is {sentiment} with a score of {score*100:.2f}%!")
|
61 |
-
# elif sentiment == "Negative":
|
62 |
-
# st.error(f"The sentiment is {sentiment} with a score of {score*100:.2f}%!")
|
63 |
-
# else:
|
64 |
-
# st.warning(f"The sentiment is {sentiment} with a score of {score*100:.2f}%!")
|
65 |
|
66 |
def preprocess(text):
|
67 |
new_text = []
|
@@ -88,6 +66,4 @@ if button:
|
|
88 |
|
89 |
labels = ['Negative','Neutral','Positive']
|
90 |
scores = {l:float(s) for (l,s) in zip(labels,scores_)}
|
91 |
-
# st.write("Logits: ",output.logits)
|
92 |
-
# y_pred = np.argmax(output.logits.detach().numpy(),axis =1)
|
93 |
st.write("Prediction :",scores)
|
|
|
5 |
from scipy.special import softmax
|
6 |
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# Add description and title
|
9 |
st.write("""
|
10 |
# Sentiment Analysis App
|
|
|
40 |
unsafe_allow_html=True
|
41 |
)
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
def preprocess(text):
|
45 |
new_text = []
|
|
|
66 |
|
67 |
labels = ['Negative','Neutral','Positive']
|
68 |
scores = {l:float(s) for (l,s) in zip(labels,scores_)}
|
|
|
|
|
69 |
st.write("Prediction :",scores)
|