mbalvi commited on
Commit
40f9580
·
verified ·
1 Parent(s): e6a01c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+
4
+ st.title("✨ Quote Generator")
5
+ st.write("Click the button below to get a random inspirational quote.")
6
+
7
+ if st.button("Generate Quote"):
8
+ try:
9
+ # Using the Quotable API
10
+ response = requests.get("https://api.quotable.io/random")
11
+ if response.status_code == 200:
12
+ data = response.json()
13
+ quote = data["content"]
14
+ author = data["author"]
15
+ st.success(f"💡 *{quote}* \n — {author}")
16
+ else:
17
+ st.error("⚠️ Could not fetch quote. Please try again later.")
18
+ except Exception as e:
19
+ st.error(f"⚠️ An error occurred: {e}")