diff --git a/src/apps/pages/programs/ApiPrograms/quotes.py b/src/apps/pages/programs/ApiPrograms/quotes.py new file mode 100644 index 0000000..b453aab --- /dev/null +++ b/src/apps/pages/programs/ApiPrograms/quotes.py @@ -0,0 +1,20 @@ +import streamlit as st +import requests + +def show_quote(): + def get_quote(): + response = requests.get("https://zenquotes.io/api/today") + if response.status_code == 200: + return response.json()[0] + else: + return None + + st.title("Quote of the Day") + + quote = get_quote() + box = st.empty() + if quote: + text = f"**{quote['q']}**\n\n— {quote['a']}" + box.markdown(text) + else: + st.write("Couldn't fetch a quote at this moment. Please try again later.") \ No newline at end of file diff --git a/src/apps/pages/programs/apiProgram.py b/src/apps/pages/programs/apiProgram.py index cbb6b10..ff4302b 100644 --- a/src/apps/pages/programs/apiProgram.py +++ b/src/apps/pages/programs/apiProgram.py @@ -2,7 +2,7 @@ def apiPrograms(): st.title('API Programs') - choice = st.selectbox('Select a program to execute', [None, "Jokes", "General Facts", "Gemini ChatBot"]) + choice = st.selectbox('Select a program to execute', [None, "Jokes", "General Facts", "Gemini ChatBot", "Quote of the Day"]) st.markdown('---') if choice == "Jokes": from src.apps.pages.programs.ApiPrograms.joke import play_joke @@ -13,6 +13,9 @@ def apiPrograms(): elif choice == "Gemini ChatBot": from src.apps.pages.programs.ApiPrograms.genAIChatbot import chatBot chatBot() + elif choice == "Quote of the Day": + from src.apps.pages.programs.ApiPrograms.quotes import show_quote + show_quote() else: st.info("Star this project on [GitHub](https://github.com/Avdhesh-Varshney/Jarvis), if you like it!", icon='⭐')