duatanzeel commited on
Commit
e30c530
Β·
verified Β·
1 Parent(s): a361047

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -23
app.py CHANGED
@@ -1,29 +1,23 @@
1
  import streamlit as st
2
  import random
3
 
4
- # Page title
5
- st.set_page_config(page_title="🎲 Dice Roller Story Bot", page_icon="🎲")
6
- st.title("🎲 Dice Roller + Mini Story Bot")
7
- st.markdown("Click the button to roll a dice and see what happens in your story!")
8
 
9
- # Define dice roll outcomes
10
- story_outcomes = {
11
- 1: "🧟 You encountered a zombie and ran for your life!",
12
- 2: "πŸ’° You found a hidden treasure under a tree!",
13
- 3: "πŸ‰ A dragon appeared... but it just wanted a hug.",
14
- 4: "πŸ›‘οΈ You discovered an ancient shield with magical powers!",
15
- 5: "πŸ„ You ate a glowing mushroom and now you can talk to animals.",
16
- 6: "πŸ•³οΈ You fell into a secret tunnel leading to a lost kingdom!"
17
- }
18
 
19
- # Roll the dice
20
- if st.button("Roll the Dice 🎲"):
21
- roll = random.randint(1, 6)
22
- st.subheader(f"You rolled a **{roll}**!")
23
- st.success(story_outcomes[roll])
24
- else:
25
- st.info("Ready to roll? Click the button above!")
26
 
27
- # Footer
28
- st.markdown("---")
29
- st.caption("Made with ❀️ using Streamlit and Hugging Face Spaces")
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import random
3
 
4
+ st.set_page_config(page_title="Dice Roller", page_icon="🎲")
 
 
 
5
 
6
+ st.title("🎲 Dice Roller Game")
 
 
 
 
 
 
 
 
7
 
8
+ st.write("Click the button to roll the dice!")
 
 
 
 
 
 
9
 
10
+ if st.button("Roll Dice"):
11
+ dice_value = random.randint(1, 6)
12
+ st.success(f"You rolled a {dice_value}!")
13
+
14
+ dice_faces = {
15
+ 1: "βš€",
16
+ 2: "⚁",
17
+ 3: "βš‚",
18
+ 4: "βšƒ",
19
+ 5: "βš„",
20
+ 6: "βš…"
21
+ }
22
+
23
+ st.markdown(f"<h1 style='font-size:100px; text-align: center;'>{dice_faces[dice_value]}</h1>", unsafe_allow_html=True)