File size: 3,078 Bytes
ea0e911
 
 
 
 
 
 
 
 
747ada8
ea0e911
 
 
 
 
fb6156b
ea0e911
 
 
 
 
fb6156b
ea0e911
 
 
 
 
fb6156b
ea0e911
 
 
 
 
fb6156b
ea0e911
 
 
 
 
fb6156b
ea0e911
 
 
 
 
fb6156b
ea0e911
 
 
 
 
fb6156b
ea0e911
 
 
 
 
 
 
 
 
 
a9488b8
ea0e911
 
a9488b8
ea0e911
 
a9488b8
ea0e911
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import streamlit as st
from PIL import Image

# Define pages
pages = {
    'page1': {
        'text': "You are a brave hero on a quest to save the princess. You must travel through a dangerous forest to reach the castle where she is being held captive. Do you want to go left or right?",
        'left': 'page2',
        'right': 'page3',
        'image': 'Aaron_Wacker_Peter_Paul_Rubens_Masterpieces_muscle_monsters_05402d99-cc69-4f6a-965c-fcb08953aa56.png'
    },
    'page2': {
        'text': "You chose to go left. You come across a river. Do you want to swim across or build a raft?",
        'left': 'page4',
        'right': 'page5',
        'image': 'Aaron_Wacker_Phoenix_Launch.png'
    },
    'page3': {
        'text': "You chose to go right. You come across a pack of wolves. Do you want to fight them or run away?",
        'left': 'page6',
        'right': 'page7',
        'image': 'Aaron_Wacker_knight_in_full_platemail_chrome_armor_shining_and__2722e7a1-be10-416b-9d5e-b41da14216d8.png'
    },
    'page4': {
        'text': "You chose to swim across. You make it to the other side safely.",
        'left': 'page8',
        'right': 'page8',
        'image': 'Aaron_Wacker_knight_in_full_platemail_chrome_armor_shining_and__3404dccb-d712-4027-a53e-63834b38bb05.png'
    },
    'page5': {
        'text': "You chose to build a raft. It takes a while, but you eventually make it across the river safely.",
        'left': 'page8',
        'right': 'page8',
        'image': 'Aaron_Wacker_knight_in_full_platemail_chrome_armor_shining_and__e110f029-9dea-4f34-bc78-1e92ef186d23.png'
    },
    'page6': {
        'text': "You chose to fight the wolves. You defeat them, but you sustain some injuries in the process.",
        'left': 'page8',
        'right': 'page8',
        'image': 'Aaron_Wacker_oil_painting_impasto_luminous_masterpiece_peter_pa_8fd22bdd-cff4-4486-b125-6e2831ee1cce.png'
    },
    'page7': {
        'text': "You chose to run away. You escape the wolves, but you get lost in the forest.",
        'left': 'page8',
        'right': 'page8',
        'image': 'Aaron_Wacker_quantum_gate_singularity_transmission_to_earth_hum_5ee55a62-c6ba-435c-a4aa-c843b29be775.png'
    },
    'page8': {
        'text': "You continue on your journey and eventually reach the castle where the princess is being held. You rescue her and she rewards you with a chest full of gold.",
        'left': None,
        'right': None,
        'image': 'Aaron_Wacker_quantum_gate_singularity_transmission_to_earth_hum_d03f6f79-1151-4393-ab1a-fb5e1bead2ec.png'
    }
}

# Define show_page function
def show_page(page_name):
    page = pages[page_name]
    image = Image.open(page['image'])
    st.image(image, caption='', use_column_width=True)
    st.write(page['text'])
    if page['left'] is not None:
        if st.button('Go left', key=hash(page['left'])):
            show_page(page['left'])
    if page['right'] is not None:
        if st.button('Go right', key=hash(page['right'])):
            show_page(page['right'])


# Render initial page
show_page('page1')