Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,45 @@
|
|
1 |
import streamlit as st
|
2 |
|
3 |
-
#
|
4 |
story_content = [
|
5 |
{"id": "start",
|
6 |
"text": "Essie grows fascinated with faeries and leprechauns, following her grandmother's tales. π§",
|
7 |
-
"choices": [("
|
8 |
},
|
9 |
{"id": "choice_a",
|
10 |
-
"text": "
|
11 |
-
"choices": [("
|
12 |
},
|
13 |
-
{"id": "
|
14 |
-
"text": "Essie
|
15 |
-
"choices": [("
|
16 |
},
|
17 |
-
{"id": "
|
18 |
-
"text": "
|
19 |
-
"choices": [("
|
20 |
},
|
21 |
-
{"id": "
|
22 |
-
"text": "
|
23 |
-
"choices": [("
|
24 |
},
|
25 |
-
{"id": "
|
26 |
-
"text": "
|
27 |
-
"choices": [("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
},
|
29 |
-
{"id": "
|
30 |
-
"text": "
|
31 |
"choices": [("Restart", "start")]
|
32 |
},
|
33 |
-
{"id": "
|
34 |
-
"text": "
|
35 |
"choices": [("Restart", "start")]
|
36 |
}
|
37 |
]
|
@@ -42,8 +50,13 @@ def render_story_point(story_id):
|
|
42 |
st.write(story_point["text"])
|
43 |
for choice_text, next_id in story_point["choices"]:
|
44 |
if st.button(choice_text):
|
45 |
-
|
46 |
break
|
47 |
|
48 |
-
st.title("Choose Your Own Adventure: Essie's
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
# Expanded story content with directions
|
4 |
story_content = [
|
5 |
{"id": "start",
|
6 |
"text": "Essie grows fascinated with faeries and leprechauns, following her grandmother's tales. π§",
|
7 |
+
"choices": [("Explore", "choice_a")]
|
8 |
},
|
9 |
{"id": "choice_a",
|
10 |
+
"text": "Which direction does Essie explore? π§",
|
11 |
+
"choices": [("North", "north_discovery"), ("South", "south_discovery"), ("East", "east_discovery"), ("West", "west_discovery")]
|
12 |
},
|
13 |
+
{"id": "north_discovery",
|
14 |
+
"text": "Essie discovers a hidden glen, alive with faerie lights. π",
|
15 |
+
"choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
|
16 |
},
|
17 |
+
{"id": "south_discovery",
|
18 |
+
"text": "Essie finds a mystical lake reflecting the moon's glow. π",
|
19 |
+
"choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
|
20 |
},
|
21 |
+
{"id": "east_discovery",
|
22 |
+
"text": "Essie encounters a grove with a mysterious faerie circle. π",
|
23 |
+
"choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
|
24 |
},
|
25 |
+
{"id": "west_discovery",
|
26 |
+
"text": "Essie stumbles upon an ancient tree, rumored to be a portal to the Otherworld. π³",
|
27 |
+
"choices": [("Perform a ritual", "ritual_outcome"), ("Explore cautiously", "explore_outcome")]
|
28 |
+
},
|
29 |
+
{"id": "ritual_outcome",
|
30 |
+
"text": "The ritual connects Essie with the faerie realm, leading to a magical encounter. β¨",
|
31 |
+
"choices": [("Use knowledge to preserve tradition", "preserve_tradition"), ("Use gift for personal gain", "personal_gain")]
|
32 |
+
},
|
33 |
+
{"id": "explore_outcome",
|
34 |
+
"text": "Cautious exploration reveals hidden truths of the mystical world. π",
|
35 |
+
"choices": [("Use knowledge to preserve tradition", "preserve_tradition"), ("Use gift for personal gain", "personal_gain")]
|
36 |
},
|
37 |
+
{"id": "preserve_tradition",
|
38 |
+
"text": "Essie returns home, enriched with stories and traditions to pass down. π",
|
39 |
"choices": [("Restart", "start")]
|
40 |
},
|
41 |
+
{"id": "personal_gain",
|
42 |
+
"text": "Using her new-found knowledge/gift, Essie seeks to benefit herself, changing her destiny. π°",
|
43 |
"choices": [("Restart", "start")]
|
44 |
}
|
45 |
]
|
|
|
50 |
st.write(story_point["text"])
|
51 |
for choice_text, next_id in story_point["choices"]:
|
52 |
if st.button(choice_text):
|
53 |
+
st.session_state['current_id'] = next_id # Update the current story ID in session state
|
54 |
break
|
55 |
|
56 |
+
st.title("Choose Your Own Adventure: Essie's Journey")
|
57 |
+
|
58 |
+
# Initialize or update current story ID in session state
|
59 |
+
if 'current_id' not in st.session_state:
|
60 |
+
st.session_state['current_id'] = "start"
|
61 |
+
|
62 |
+
render_story_point(st.session_state['current_id'])
|