Spaces:
Build error
Build error
Delete app.py
Browse files
app.py
DELETED
@@ -1,31 +0,0 @@
|
|
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()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|