Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,28 +1,16 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
headers = {"Authorization": "Bearer YOUR_HF_API_TOKEN"} # <-- replace with your token
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
topic = st.text_input("Enter a topic (e.g., happiness, love, success):", "")
|
| 16 |
|
| 17 |
if st.button("Generate Quote"):
|
| 18 |
-
|
| 19 |
-
prompt = "Here is an inspiring quote:"
|
| 20 |
-
else:
|
| 21 |
-
prompt = f"Here is an inspiring quote about {topic}:"
|
| 22 |
-
|
| 23 |
-
output = query({"inputs": prompt, "max_length": 50, "num_return_sequences": 1})
|
| 24 |
-
|
| 25 |
-
if isinstance(output, list) and len(output) > 0:
|
| 26 |
-
st.success(output[0]['generated_text'])
|
| 27 |
-
else:
|
| 28 |
-
st.error("Something went wrong. Try again.")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import random
|
| 3 |
|
| 4 |
+
st.title("✨ Simple Quote Generator")
|
| 5 |
+
st.write("Click the button to get an inspiring quote!")
|
|
|
|
| 6 |
|
| 7 |
+
quotes = [
|
| 8 |
+
"The best way to get started is to quit talking and begin doing.",
|
| 9 |
+
"Don’t let yesterday take up too much of today.",
|
| 10 |
+
"It’s not whether you get knocked down, it’s whether you get up.",
|
| 11 |
+
"If you are working on something exciting, it will keep you motivated.",
|
| 12 |
+
"Success is not in what you have, but who you are."
|
| 13 |
+
]
|
|
|
|
| 14 |
|
| 15 |
if st.button("Generate Quote"):
|
| 16 |
+
st.success(random.choice(quotes))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|