Sachitksh commited on
Commit
8553bb0
·
verified ·
1 Parent(s): d0256f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -19
app.py CHANGED
@@ -1,27 +1,25 @@
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["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!")
 
1
  import streamlit as st
2
  from langchain_google_genai import ChatGoogleGenerativeAI
3
 
4
+ st.title("Text Summarizer")
5
 
6
+ def generate_summary(text):
7
+ prompt = f"Summarize the following text: {text}"
 
 
8
  llm = ChatGoogleGenerativeAI(model="gemini-pro", google_api_key=st.secrets["API_KEY"])
9
+ summary = llm.invoke(prompt)
10
+ summary = summary.content
11
+ return summary
12
 
13
+ with st.form("text_summarizer_form"):
14
+ text = st.text_area("Enter the text you want to summarize")
15
+ submitted = st.form_submit_button("Summarize")
16
 
17
+ if submitted and text:
18
+ summary = generate_summary(text)
19
+ st.subheader("Summary:")
20
+ st.write(summary)
21
+ elif submitted and not text:
22
+ st.error("Please enter text to summarize.")
23
 
24
+ if st.button("Need Inspiration?"):
25
+ st.write("Summarizing can help you understand the key points quickly. Keep practicing!")