|
import streamlit as st |
|
import random |
|
import pandas as pd |
|
|
|
|
|
if 'current_mood' not in st.session_state: |
|
st.session_state['current_mood'] = 'neutral' |
|
if 'story_progress' not in st.session_state: |
|
st.session_state['story_progress'] = 0 |
|
|
|
|
|
characters = [ |
|
{"name": "Alex", "profession": "Software Developer", "trait": "Genius"}, |
|
{"name": "Jamie", "profession": "Graphic Novelist", "trait": "Creative"}, |
|
{"name": "LoveBot", "profession": "AI", "trait": "Empathetic"} |
|
] |
|
events = [ |
|
{"event": "breakup", "emoji": "π", "description": "A sudden breakup."}, |
|
{"event": "detective", "emoji": "π΅οΈββοΈ", "description": "A detective unveils secrets."}, |
|
{"event": "wizard", "emoji": "π§ββοΈ", "description": "A modern-day wizard alters the course."} |
|
] |
|
|
|
|
|
st.title("Romantic Comedies and Tragedies in the Digital Age") |
|
|
|
|
|
st.subheader("Character Selection") |
|
character_choice = st.selectbox("Choose your character:", [c["name"] for c in characters]) |
|
|
|
|
|
selected_character = next(c for c in characters if c["name"] == character_choice) |
|
st.write(f"Profession: {selected_character['profession']}") |
|
st.write(f"Trait: {selected_character['trait']}") |
|
|
|
|
|
st.subheader("Customize Your Adventure") |
|
uploaded_file = st.file_uploader("Upload your adventure image", type=['jpg', 'png']) |
|
if uploaded_file is not None: |
|
st.image(uploaded_file, caption='Your Adventure Image') |
|
|
|
|
|
|
|
|
|
|
|
st.subheader("Choose Your Plot Twist") |
|
plot_twist_choice = st.radio("Plot twist options:", [e["emoji"] + " " + e["event"] for e in events]) |
|
|
|
|
|
selected_event = next(e for e in events if e["emoji"] in plot_twist_choice) |
|
st.write(f"Event Description: {selected_event['description']}") |
|
|
|
|
|
st.subheader("Character Stats") |
|
character_stats = pd.DataFrame(characters) |
|
st.dataframe(character_stats) |
|
|
|
|
|
st.subheader("Fate Dice") |
|
if st.button("Roll the Dice"): |
|
dice_roll = random.randint(1, 6) |
|
st.session_state['story_progress'] += dice_roll |
|
st.write(f"Dice roll: {dice_roll} π²") |
|
st.write(f"Story Progress: {st.session_state['story_progress']}") |
|
|
|
|
|
st.write(f"Current mood: {st.session_state['current_mood']}") |
|
|
|
|
|
def update_mood(new_mood): |
|
st.session_state['current_mood'] = new_mood |
|
|
|
|
|
if st.button("Happy Mood"): |
|
update_mood("happy π") |
|
|
|
|