Sachitksh commited on
Commit
7e6626e
·
verified ·
1 Parent(s): a5e831f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from langchain_google_genai import ChatGoogleGenerativeAI
3
+
4
+ st.title("Exercise and Yoga Chatbot")
5
+
6
+ def generate_response(topic):
7
+ prompt = (
8
+ f"Create a detailed guide on {topic}. Include instructions, tips, and benefits."
9
+ )
10
+ llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["GOOGLE_API_KEY"])
11
+ answers = llm.invoke(prompt)
12
+ answers = answers.content
13
+ return answers
14
+
15
+ with st.form("exercise_yoga_form"):
16
+ topic = st.text_area("Ask about Exercise or Yoga")
17
+ submitted = st.form_submit_button("Get Guide")
18
+
19
+ if submitted and topic:
20
+ response = generate_response(topic)
21
+ st.subheader("Here is your guide:")
22
+ st.write(response)
23
+ elif submitted and not topic:
24
+ st.error("Please enter a topic to get a guide.")
25
+
26
+ if st.button("Need Motivation?"):
27
+ st.write("Remember, consistency is key! Keep pushing forward and stay active. Your body will thank you!")