Spaces:
Build error
Build error
File size: 1,165 Bytes
dc308cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
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.")
|