Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,11 @@ def analyze_sentiment(input_text):
|
|
43 |
return str(score), sentiment_label_with_emoji, sentiment_category
|
44 |
|
45 |
def analyze_sentiments_from_excel(file):
|
46 |
-
|
|
|
|
|
|
|
|
|
47 |
results = []
|
48 |
|
49 |
for text in df['Text']:
|
@@ -82,6 +86,7 @@ def analyze_sentiments_from_excel(file):
|
|
82 |
|
83 |
return results_df, sentiment_counts, fig_labels, fig_scores, wordcloud_fig
|
84 |
|
|
|
85 |
def switch_app(app_name):
|
86 |
if app_name == "Sentiment Analysis":
|
87 |
iface1.show()
|
|
|
43 |
return str(score), sentiment_label_with_emoji, sentiment_category
|
44 |
|
45 |
def analyze_sentiments_from_excel(file):
|
46 |
+
try:
|
47 |
+
df = pd.read_excel(file.name)
|
48 |
+
except Exception as e:
|
49 |
+
return str(e), None, None, None, None # Return error message if file cannot be read
|
50 |
+
|
51 |
results = []
|
52 |
|
53 |
for text in df['Text']:
|
|
|
86 |
|
87 |
return results_df, sentiment_counts, fig_labels, fig_scores, wordcloud_fig
|
88 |
|
89 |
+
|
90 |
def switch_app(app_name):
|
91 |
if app_name == "Sentiment Analysis":
|
92 |
iface1.show()
|