Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import random | |
| def convert_alexandre_time(minutes): | |
| multiplier = random.uniform(2.5, 4) | |
| return int(minutes * multiplier) | |
| def generate_activity(minutes): | |
| activities = [ | |
| f"Learn {minutes // 5} new words in a foreign language", | |
| f"Do {minutes * 2} push-ups", | |
| f"Write a {minutes}-word short story", | |
| f"Meditate for {minutes} minutes", | |
| f"Learn to juggle {min(3, minutes // 10)} balls", | |
| f"Try to solve a Rubik's cube {minutes // 5} times", | |
| f"Practice your moonwalk for {minutes} minutes", | |
| f"Memorize {minutes // 2} digits of pi", | |
| f"Try to balance a spoon on your nose for {minutes} seconds", | |
| f"Come up with {minutes // 2} new nicknames for Alexandre" | |
| ] | |
| return random.choice(activities) | |
| st.set_page_config(page_title="Alexandre's Time Converter", page_icon="⏰") | |
| st.title("🕰️ Alexandre's Time Converter 🕰️") | |
| st.subheader("Convert Alexandre's 'optimistic' estimates into reality!") | |
| st.write(""" | |
| Welcome to the ultimate tool for decoding Alexandre's unique perception of time! | |
| Ever wondered how long "I'll be there in 5 minutes" actually means in Alexandre's world? | |
| Wonder no more! Use this state-of-the-art converter to translate Alexandre's time estimates into what the rest of us call "reality." | |
| """) | |
| alexandre_time = st.number_input("Enter Alexandre's estimated time (in minutes):", min_value=1, value=5, step=1) | |
| if st.button("Unveil the Truth"): | |
| real_time = convert_alexandre_time(alexandre_time) | |
| st.success(f"Alexandre's Fantasy: {alexandre_time} minutes") | |
| st.error(f"Harsh Reality: {real_time} minutes") | |
| if real_time > 60: | |
| hours = real_time // 60 | |
| minutes = real_time % 60 | |
| st.warning(f"Brace yourself! That's {hours} hour{'s' if hours > 1 else ''} and {minutes} minute{'s' if minutes != 1 else ''}! You could have watched {real_time // 45} episodes of Friends by then!") | |
| excuses = [ | |
| "I got caught in a time vortex!", | |
| "My watch must be running on Alexandre Standard Time (AST).", | |
| "I had to help an old lady cross the street... five times... in different neighborhoods.", | |
| "I was abducted by aliens who wanted to learn about punctuality. Ironic, right?", | |
| "I found a shortcut that turned out to be a scenic route through three different countries.", | |
| "My pet snail escaped, and I had to chase it down.", | |
| "I was busy inventing a new unit of time measurement: the 'Alexandre minute'.", | |
| "I got stuck in quicksand... made of molasses... uphill... both ways.", | |
| "I had to attend an emergency meeting of the Procrastinators Anonymous... but we kept postponing it.", | |
| "I was chosen as a test subject for a new teleportation device. Turns out, it only slows down time.", | |
| "I was busy writing a thesis on 'The Relativity of Time: An Alexandre's Perspective'.", | |
| "I had to rescue a cat from a tree... then rescue the firefighter who got stuck rescuing the cat.", | |
| ] | |
| excuse = random.choice(excuses) | |
| st.info(f"Alexandre's excuse generator says: '{excuse}'") | |
| roasts = [ | |
| f"If Alexandre was a superhero, his power would be the ability to bend time... but only in his mind.", | |
| f"Alexandre's punctuality is so bad, even his calendar gave up and filed for divorce.", | |
| f"They say time flies when you're having fun. Alexandre must be having the time of his life... all the time.", | |
| f"Alexandre doesn't wear a watch. He uses sundials, which explains a lot about his timekeeping skills.", | |
| f"Einstein said time is relative. He must have been thinking about Alexandre when he came up with that theory.", | |
| ] | |
| st.markdown("---") | |
| st.subheader("While you're waiting for Alexandre...") | |
| activity = generate_activity(real_time) | |
| st.write(f"Why not {activity}? You've got time!") | |
| st.markdown("---") | |
| st.subheader("Alexandre's Punctuality Roast Corner") | |
| st.write(random.choice(roasts)) | |
| st.markdown("---") | |
| st.write("Remember, in Alexandre's world, '5 minutes' is more of a concept than an actual measurement of time!") |