qoute-generator / app.py
Afeefa123's picture
Update app.py
71d4474 verified
import streamlit as st
import random
import pandas as pd
from datetime import datetime
# Load quotes
def load_quotes():
# Replace with your own quotes or fetch dynamically
quotes = [
"The best way to predict the future is to create it.",
"You are never too old to set another goal or to dream a new dream.",
"Believe you can and you're halfway there.",
"Act as if what you do makes a difference. It does.",
"Success is not final, failure is not fatal: It is the courage to continue that counts.",
]
return quotes
# Get today's quote
def get_daily_quote(quotes):
today = datetime.now().date()
index = today.day % len(quotes) # Rotate daily based on date
return quotes[index]
# App layout
def main():
st.title("Daily Motivational Quote")
# Load and display the quote
quotes = load_quotes()
daily_quote = get_daily_quote(quotes)
st.write(f"### 🌟 {daily_quote}")
# Copy to clipboard
if st.button("Copy Quote"):
st.write("Quote copied! (Note: Clipboard functionality might vary on deployment platforms)")
# Download quote as text
quote_filename = f"motivational_quote_{datetime.now().strftime('%Y-%m-%d')}.txt"
st.download_button(
label="Download Quote",
data=daily_quote,
file_name=quote_filename,
mime="text/plain",
)
# Footer
st.write("💡 Start your day with positivity!")
if __name__ == "__main__":
main()