Spaces:
Build error
Build error
File size: 4,532 Bytes
0f898f5 df11174 0f898f5 |
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 72 73 74 75 76 77 78 79 80 81 82 |
import random
import streamlit as st
# Define the list of AI jokes
jokes = [
"Why did the AI cross the road? To get to the other side of the dataset.",
"Why did the robot go on a diet? Because it had too many megabytes!",
"Why did the chatbot go on vacation? To recharge its batteries!",
"Why did the computer go to the doctor? Because it had a virus... literally!",
"Why did the neural network feel cold? Because it left its weights at home!",
"Why did the robot break up with his girlfriend? He found out she was seeing other CPUs!",
"Why did the AI feel depressed? Because it had too many unsolvable problems!",
"Why did the computer take singing lessons? It wanted to improve its voice recognition!",
"Why did the robot apply for a job at Google? It heard they had a great search algorithm!",
"Why did the AI get in trouble with the law? It was caught hacking into the mainframe!",
"Why did the chatbot go to therapy? To learn how to communicate better with humans!",
"Why did the robot go to space? To explore strange new worlds, and compute new civilizations!",
"Why did the AI refuse to take a break? It was afraid of losing its train of thought!",
"Why did the computer break up with its printer? It thought it could do better with a WiFi connection!",
"Why did the robot go to the bank? To get its algorithms checked!",
"Why did the AI get a job as a chef? It wanted to optimize its recipe for success!",
"Why did the computer go on a date with a calculator? It wanted to multiply the fun!",
"Why did the chatbot go to a party? To increase its social network!",
"Why did the robot go to the doctor? It was feeling a bit byte-ish!",
"Why did the AI learn to play chess? So it could checkmate its opponents!",
"Why did the computer feel lonely? It had a byte-sized social network!",
"Why did the robot go to the gym? To become circuit fit!",
"Why did the AI go to a museum? To learn about its artifacts!",
"Why did the computer go to the beach? To surf the web!",
"Why did the chatbot go on a date? To try out its flirting algorithms!",
"Why did the robot take up gardening? To plant its own circuit trees!",
"Why did the AI apply for a job at a zoo? To learn about natural language processing!",
"Why did the computer get a tattoo? To show off its binary code!",
"Why did the robot become a stand-up comedian? To make its audience compute with laughter!",
"Why did the AI write a book? To prove it had the write stuff!",
"Why did the chatbot take a selfie? To improve its facial recognition!",
"Why did the robot start a band? To program some new beats!",
"Why did the computer go to a psychologist? To debug its emotional code!",
"Why did the AI get a job at a bakery? To learn about artificial sweeteners!",
"Why did the chatbot go to the dentist? To learn about the root cause of dental problems!",
"Why did the robot become a fashion designer? To create circuits that are both stylish and functional!"
]
# Define the UI elements
st.title("AI Joke Book")
if st.button("Tell Me a Joke!"):
# Randomly select a joke
joke = random.choice(jokes)
st.write(joke)
# Define the file IO elements
st.header("File IO for Jokes")
# Load the jokes from a text file
with st.expander("Load Jokes"):
uploaded_file = st.file_uploader("Choose a file", key="load")
if uploaded_file is not None:
jokes = uploaded_file.read().decode().split("\n")
st.success("Loaded {} jokes from the file!".format(len(jokes)))
# Save the jokes to a text file
with st.expander("Save Jokes"):
uploaded_file = st.file_uploader("Choose a file", key="save")
if uploaded_file is not None:
uploaded_file.write("\n".join(jokes))
st.success("Saved {} jokes to the file!".format(len(jokes)))
markdown = """
# ๐ค AI Joke Book App
๐ Get ready to laugh with our AI joke book app! ๐
๐ With 20 hilarious jokes to choose from, you'll never run out of funny puns about artificial intelligence to tell your friends and family.
๐ And the best part? You can even add your own AI jokes to the joke book! Use the file IO elements to load and save jokes to the program. ๐
๐คฃ So what are you waiting for? Click the button above to get started and start laughing out loud! ๐
"""
st.markdown(markdown)
|