Files changed (2) hide show
  1. app.py +10 -33
  2. app0.py +0 -48
app.py CHANGED
@@ -3,15 +3,12 @@ from langchain_community.llms import OpenAI
3
  from langchain_core.prompts import PromptTemplate
4
  import streamlit as st
5
 
6
- # Set the page to wide mode
7
- st.set_page_config(layout="wide")
8
-
9
  mini_template = "You are an expert researcher. You\'ve talked to hundreds of {Target Audience}. \
10
  Each person in the niche of {Target Audience} has certain struggles that make it easier to sell {My Course}. \
11
  These are called Pain Points. There's a recipe for getting to the core of the Pain Points of {Target Audience}. \
12
  Namely, answer each of these Questions 3 times, each getting deeper in the issues of {Target Audience}, \
13
  appealing to their Emotions and uncertainties related to {My Course}. \
14
- The Questions (answer each QUESTION 3 times in listicle format according to the instructions):\
15
  1. What keeps them awake at night?\
16
  2. What are they afraid of?\
17
  3. What are they angry about?\
@@ -30,42 +27,22 @@ chain = LLMChain(llm=OpenAI(), prompt=prompt)
30
  #target_audience = "professionals looking for course on Power BI"
31
  #my_course = "Zero to Hero in PowerBI"
32
 
33
- # Use the sidebar for input
34
- target_audience = st.sidebar.text_input("Enter your target audience")
35
- my_course = st.sidebar.text_input("Enter your course name")
36
 
37
- if st.sidebar.button("Get response"):
38
  if target_audience and my_course:
39
  with st.spinner("Generating response..."):
40
  with st.expander("Show prompt", expanded=False):
41
- st.info(prompt.template)
42
- answer = chain.run({"Target Audience": target_audience, "My Course": my_course})
43
-
44
- # Split the 'answer' into sections based on the questions
45
- sections = [section.strip() for section in answer.split("\n\n") if section.strip() != ""]
46
-
47
- # Assuming there are exactly three sections based on your output structure
48
- if len(sections) == 3:
49
- # Extract titles for tabs
50
- titles = [section.split('\n')[0] for section in sections]
51
-
52
- # Extract content for each section, removing the title
53
- contents = [section.split('\n')[1:] for section in sections]
54
-
55
- # Create tabs for each category
56
- tabs = st.tabs(titles)
57
-
58
- for i, tab in enumerate(tabs):
59
- with tab:
60
- st.header(titles[i])
61
- for content in contents[i]:
62
- st.markdown(content)
63
- else:
64
- st.error("The answer format does not match the expected structure.")
65
- st.success("Hope you like the response.❤")
66
  elif target_audience:
67
  st.error("Enter your course name.")
68
  elif my_course:
69
  st.error("Enter your target audience.")
 
70
  else:
71
  st.error("No input detected, Please provide the desired information.")
 
3
  from langchain_core.prompts import PromptTemplate
4
  import streamlit as st
5
 
 
 
 
6
  mini_template = "You are an expert researcher. You\'ve talked to hundreds of {Target Audience}. \
7
  Each person in the niche of {Target Audience} has certain struggles that make it easier to sell {My Course}. \
8
  These are called Pain Points. There's a recipe for getting to the core of the Pain Points of {Target Audience}. \
9
  Namely, answer each of these Questions 3 times, each getting deeper in the issues of {Target Audience}, \
10
  appealing to their Emotions and uncertainties related to {My Course}. \
11
+ The Questions (answer each QUESTION 3 tiems in listicle format according to the instructions):\
12
  1. What keeps them awake at night?\
13
  2. What are they afraid of?\
14
  3. What are they angry about?\
 
27
  #target_audience = "professionals looking for course on Power BI"
28
  #my_course = "Zero to Hero in PowerBI"
29
 
30
+ target_audience = st.text_input("Enter your target audience")
31
+ my_course = st.text_input("Enter your course name")
 
32
 
33
+ if st.button("Get resposne"):
34
  if target_audience and my_course:
35
  with st.spinner("Generating response..."):
36
  with st.expander("Show prompt", expanded=False):
37
+ st.info(prompt.template)
38
+ answer = chain.run({"Target Audience": target_audience, "My Course":my_course})
39
+
40
+ st.write(answer)
41
+ st.success("Hope you like the resposne.❤")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  elif target_audience:
43
  st.error("Enter your course name.")
44
  elif my_course:
45
  st.error("Enter your target audience.")
46
+
47
  else:
48
  st.error("No input detected, Please provide the desired information.")
app0.py DELETED
@@ -1,48 +0,0 @@
1
- from langchain.chains import LLMChain
2
- from langchain_community.llms import OpenAI
3
- from langchain_core.prompts import PromptTemplate
4
- import streamlit as st
5
-
6
- mini_template = "You are an expert researcher. You\'ve talked to hundreds of {Target Audience}. \
7
- Each person in the niche of {Target Audience} has certain struggles that make it easier to sell {My Course}. \
8
- These are called Pain Points. There's a recipe for getting to the core of the Pain Points of {Target Audience}. \
9
- Namely, answer each of these Questions 3 times, each getting deeper in the issues of {Target Audience}, \
10
- appealing to their Emotions and uncertainties related to {My Course}. \
11
- The Questions (answer each QUESTION 3 tiems in listicle format according to the instructions):\
12
- 1. What keeps them awake at night?\
13
- 2. What are they afraid of?\
14
- 3. What are they angry about?\
15
- "
16
-
17
-
18
- st.title("Saas Application")
19
-
20
- prompt = PromptTemplate(
21
- input_variables = ["Target Audience", "My Course"],
22
- template=mini_template,
23
- )
24
-
25
- chain = LLMChain(llm=OpenAI(), prompt=prompt)
26
-
27
- #target_audience = "professionals looking for course on Power BI"
28
- #my_course = "Zero to Hero in PowerBI"
29
-
30
- target_audience = st.text_input("Enter your target audience")
31
- my_course = st.text_input("Enter your course name")
32
-
33
- if st.button("Get resposne"):
34
- if target_audience and my_course:
35
- with st.spinner("Generating response..."):
36
- with st.expander("Show prompt", expanded=False):
37
- st.info(prompt.template)
38
- answer = chain.run({"Target Audience": target_audience, "My Course":my_course})
39
-
40
- st.write(answer)
41
- st.success("Hope you like the resposne.❤")
42
- elif target_audience:
43
- st.error("Enter your course name.")
44
- elif my_course:
45
- st.error("Enter your target audience.")
46
-
47
- else:
48
- st.error("No input detected, Please provide the desired information.")