awacke1's picture
Update app.py
dab7018
# ChatGPT Prompt: write a streamlit program that generates a graphical emotion wheel that can animate a spin. With the animated emotion wheel, display it as a pie graph sunburst plot with an emoji for each of the emotions including: love, fear, anger, sadness, happiness, surprise, disgust, and love.
import streamlit as st
import pandas as pd
import numpy as np
import plotly.express as px
import matplotlib.pyplot as plt
import seaborn as sns
# Create an emotion wheel
emotions = ["Love", "Fear", "Anger", "Sadness", "Happiness", "Surprise", "Disgust", "Love"]
#emoji = ["❤️", "😱", "😠", "😢", "🤩", "😮", "🤢", "❤️"]
emoji = [1, 2, 3, 4, 5, 6, 7, 8]
# Add the wheel to the sidebar
st.sidebar.title("Emotion Wheel")
st.sidebar.radio("Choose an emotion", emotions)
# Create a sunburst chart
df = pd.DataFrame({"emotion": emotions, "emoji": emoji})
fig = px.sunburst(df, values="emoji", path=["emotion"], color="emoji")
# Plot the chart
st.plotly_chart(fig, use_container_width=True)
# Add an animation button
animation_button = st.button("Animate")
# Animate the chart
if animation_button:
for i in range(10):
random_emotion = np.random.choice(emotions)
st.sidebar.radio("Choose an emotion", [random_emotion])
fig = px.sunburst(df, values="emoji", path=["emotion"], color="emoji")
st.plotly_chart(fig, use_container_width=True)