Spaces:
Paused
Paused
import streamlit as st | |
from spirit_animal.pages import intro, quiz, image_gen | |
# Define stateful objects | |
if "openai_model" not in st.session_state: | |
st.session_state["openai_model"] = "gpt-4" | |
if "spirit_animal" not in st.session_state: | |
st.session_state["spirit_animal"] = "" | |
# Define the pages | |
PAGES = {"Intro": "intro", "Quiz": "quiz", "Build Your Surprise": "image_gen"} | |
# Page functions dictionary | |
PAGE_FUNCTIONS = { | |
"intro": intro.intro, | |
"quiz": quiz.quiz, | |
"image_gen": image_gen.image_gen, | |
} | |
def main(): | |
st.sidebar.title("Navigation :world_map:") | |
choice = st.sidebar.selectbox("Go to", list(PAGES.keys())) | |
# Call the page function | |
PAGE_FUNCTIONS[PAGES[choice]]() | |
if __name__ == "__main__": | |
main() | |