Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from PIL import Image
|
|
3 |
from transformers import pipeline
|
4 |
import pandas as pd
|
5 |
import matplotlib.pyplot as plt
|
|
|
6 |
|
7 |
# Initialize session state for results, image names, and image sizes if not already present
|
8 |
if 'results' not in st.session_state:
|
@@ -94,6 +95,14 @@ if st.button("Generate DataFrame"):
|
|
94 |
# Display the DataFrame
|
95 |
st.write(df_emotions)
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
# Optional: Save the DataFrame to a CSV file
|
98 |
df_emotions.to_csv('emotion_scores.csv', index=False)
|
99 |
st.success('DataFrame generated and saved as emotion_scores.csv')
|
|
|
3 |
from transformers import pipeline
|
4 |
import pandas as pd
|
5 |
import matplotlib.pyplot as plt
|
6 |
+
import seaborn as sns
|
7 |
|
8 |
# Initialize session state for results, image names, and image sizes if not already present
|
9 |
if 'results' not in st.session_state:
|
|
|
95 |
# Display the DataFrame
|
96 |
st.write(df_emotions)
|
97 |
|
98 |
+
# Plotting the heatmap for the first seven columns
|
99 |
+
plt.figure(figsize=(10, 10))
|
100 |
+
sns.heatmap(df_emotions.iloc[:, :7], annot=True, fmt=".1f", cmap='viridis')
|
101 |
+
plt.title('Heatmap of Emotion Scores')
|
102 |
+
plt.xlabel('Emotion Categories')
|
103 |
+
plt.ylabel('Data Points')
|
104 |
+
st.pyplot(plt)
|
105 |
+
|
106 |
# Optional: Save the DataFrame to a CSV file
|
107 |
df_emotions.to_csv('emotion_scores.csv', index=False)
|
108 |
st.success('DataFrame generated and saved as emotion_scores.csv')
|