Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,31 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
import
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
container = st.container()
|
8 |
|
9 |
-
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
get_position='[longitude, latitude]',
|
17 |
-
get_color='[200, 30, time / 100]',
|
18 |
-
get_radius=100,
|
19 |
-
pickable=True,
|
20 |
-
)
|
21 |
|
22 |
-
#
|
23 |
-
|
24 |
-
|
25 |
-
zoom=10,
|
26 |
-
pitch=50)
|
27 |
|
28 |
-
#
|
29 |
-
|
|
|
|
|
|
|
30 |
|
31 |
-
#
|
32 |
-
|
33 |
-
|
34 |
|
35 |
# example usage
|
36 |
-
|
37 |
-
show_pydeck_scatterplot(data_url)
|
|
|
1 |
import streamlit as st
|
2 |
+
import wikipedia
|
3 |
+
import random
|
4 |
|
5 |
+
STEM_EMOJIS = ["🔬", "🧬", "🧪", "🔭", "🛰️", "🚀", "🛸", "🖥️", "💻", "📐"]
|
6 |
+
OTHER_EMOJIS = ["😀", "😂", "😊", "🎉", "🎁", "👍", "❤️", "🤔", "😍", "😜"]
|
|
|
7 |
|
8 |
+
def getScienceEmoji():
|
9 |
+
return random.choice(STEM_EMOJIS)
|
10 |
|
11 |
+
def getwik():
|
12 |
+
# get a random science article title from Wikipedia
|
13 |
+
article_title = wikipedia.random(pages=1)
|
14 |
+
st.write(f"Random Science Article: {article_title}")
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
# load the article content
|
17 |
+
article = wikipedia.page(article_title)
|
18 |
+
st.write(article.content)
|
|
|
|
|
19 |
|
20 |
+
# simulate two D100 dice rolls
|
21 |
+
roll1 = st.slider('Roll Dice 1', 1, 100, 1)
|
22 |
+
roll2 = st.slider('Roll Dice 2', 1, 100, 1)
|
23 |
+
total_roll = roll1 + roll2
|
24 |
+
st.write(f"Dice Roll: {total_roll}")
|
25 |
|
26 |
+
# print the result with a random STEM or OTHER emoji
|
27 |
+
emoji = getScienceEmoji() if total_roll <= 50 else random.choice(OTHER_EMOJIS)
|
28 |
+
st.markdown(f"Result: {emoji} {article_title} - Roll: {total_roll}")
|
29 |
|
30 |
# example usage
|
31 |
+
getwik()
|
|