awacke1's picture
Create app.py
dc308cb
raw
history blame
1.17 kB
import random
import streamlit as st
import plotly.graph_objects as go
# Define the emojis
STEM_EMOJIS = ["🔬", "🧬", "🧪", "🔭", "🛰️", "🚀", "🛸", "🖥️", "💻", "📐"]
OTHER_EMOJIS = ["😀", "😂", "😊", "🎉", "🎁", "👍", "❤️", "🤔", "😍", "😜"]
# Define the roll_dice function
def roll_dice():
all_emojis = STEM_EMOJIS + OTHER_EMOJIS
return [random.choice(all_emojis) for i in range(20)]
# Create a mindmap chart
fig = go.Figure(go.Sunburst(
labels=['STEM Emojis', 'Other Emojis'] + STEM_EMOJIS + OTHER_EMOJIS,
parents=['', ''] + (['STEM Emojis']*len(STEM_EMOJIS)) + (['Other Emojis']*len(OTHER_EMOJIS)),
values=[1]*len(STEM_EMOJIS+OTHER_EMOJIS),
branchvalues='total',
marker=dict(colors=STEM_EMOJIS+OTHER_EMOJIS),
textinfo='label',
hovertemplate='<b>%{label}</b><br><br>',
maxdepth=1
))
fig.update_layout(
margin=dict(t=0, l=0, r=0, b=0),
width=600,
height=600
)
# Streamlit app
st.markdown("## Mindmap Chart of Emojis")
with st.beta_container():
st.plotly_chart(fig)
st.markdown("### Click on a section to zoom in, or click on the center to zoom out.")