awacke1 commited on
Commit
dc308cb
·
1 Parent(s): 550dbdf

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import streamlit as st
3
+ import plotly.graph_objects as go
4
+
5
+ # Define the emojis
6
+ STEM_EMOJIS = ["🔬", "🧬", "🧪", "🔭", "🛰️", "🚀", "🛸", "🖥️", "💻", "📐"]
7
+ OTHER_EMOJIS = ["😀", "😂", "😊", "🎉", "🎁", "👍", "❤️", "🤔", "😍", "😜"]
8
+
9
+ # Define the roll_dice function
10
+ def roll_dice():
11
+ all_emojis = STEM_EMOJIS + OTHER_EMOJIS
12
+ return [random.choice(all_emojis) for i in range(20)]
13
+
14
+ # Create a mindmap chart
15
+ fig = go.Figure(go.Sunburst(
16
+ labels=['STEM Emojis', 'Other Emojis'] + STEM_EMOJIS + OTHER_EMOJIS,
17
+ parents=['', ''] + (['STEM Emojis']*len(STEM_EMOJIS)) + (['Other Emojis']*len(OTHER_EMOJIS)),
18
+ values=[1]*len(STEM_EMOJIS+OTHER_EMOJIS),
19
+ branchvalues='total',
20
+ marker=dict(colors=STEM_EMOJIS+OTHER_EMOJIS),
21
+ textinfo='label',
22
+ hovertemplate='<b>%{label}</b><br><br>',
23
+ maxdepth=1
24
+ ))
25
+
26
+ fig.update_layout(
27
+ margin=dict(t=0, l=0, r=0, b=0),
28
+ width=600,
29
+ height=600
30
+ )
31
+
32
+ # Streamlit app
33
+ st.markdown("## Mindmap Chart of Emojis")
34
+ with st.beta_container():
35
+ st.plotly_chart(fig)
36
+ st.markdown("### Click on a section to zoom in, or click on the center to zoom out.")