Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,64 +1,50 @@
|
|
| 1 |
-
import
|
| 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 |
-
additional_inputs=[
|
| 49 |
-
gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
|
| 50 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 51 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 52 |
-
gr.Slider(
|
| 53 |
-
minimum=0.1,
|
| 54 |
-
maximum=1.0,
|
| 55 |
-
value=0.95,
|
| 56 |
-
step=0.05,
|
| 57 |
-
label="Top-p (nucleus sampling)",
|
| 58 |
-
),
|
| 59 |
-
],
|
| 60 |
-
)
|
| 61 |
-
|
| 62 |
|
| 63 |
if __name__ == "__main__":
|
| 64 |
-
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import random
|
| 3 |
+
import pandas as pd
|
| 4 |
+
from datetime import datetime
|
| 5 |
+
|
| 6 |
+
# Load quotes
|
| 7 |
+
def load_quotes():
|
| 8 |
+
# Replace with your own quotes or fetch dynamically
|
| 9 |
+
quotes = [
|
| 10 |
+
"The best way to predict the future is to create it.",
|
| 11 |
+
"You are never too old to set another goal or to dream a new dream.",
|
| 12 |
+
"Believe you can and you're halfway there.",
|
| 13 |
+
"Act as if what you do makes a difference. It does.",
|
| 14 |
+
"Success is not final, failure is not fatal: It is the courage to continue that counts.",
|
| 15 |
+
]
|
| 16 |
+
return quotes
|
| 17 |
+
|
| 18 |
+
# Get today's quote
|
| 19 |
+
def get_daily_quote(quotes):
|
| 20 |
+
today = datetime.now().date()
|
| 21 |
+
index = today.day % len(quotes) # Rotate daily based on date
|
| 22 |
+
return quotes[index]
|
| 23 |
+
|
| 24 |
+
# App layout
|
| 25 |
+
def main():
|
| 26 |
+
st.title("Daily Motivational Quote")
|
| 27 |
+
|
| 28 |
+
# Load and display the quote
|
| 29 |
+
quotes = load_quotes()
|
| 30 |
+
daily_quote = get_daily_quote(quotes)
|
| 31 |
+
st.write(f"### 🌟 {daily_quote}")
|
| 32 |
+
|
| 33 |
+
# Copy to clipboard
|
| 34 |
+
if st.button("Copy Quote"):
|
| 35 |
+
st.write("Quote copied! (Note: Clipboard functionality might vary on deployment platforms)")
|
| 36 |
+
|
| 37 |
+
# Download quote as text
|
| 38 |
+
quote_filename = f"motivational_quote_{datetime.now().strftime('%Y-%m-%d')}.txt"
|
| 39 |
+
st.download_button(
|
| 40 |
+
label="Download Quote",
|
| 41 |
+
data=daily_quote,
|
| 42 |
+
file_name=quote_filename,
|
| 43 |
+
mime="text/plain",
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
# Footer
|
| 47 |
+
st.write("💡 Start your day with positivity!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
if __name__ == "__main__":
|
| 50 |
+
main()
|