MarTech_project / app.py
KunaalNaik's picture
Update app.py
a9e64b5 verified
from langchain.chains import LLMChain
from langchain_community.llms import OpenAI
from langchain_core.prompts import PromptTemplate
import streamlit as st
# Set the page to wide mode
st.set_page_config(layout="wide")
template1_cust_pain_point = "You are an expert researcher. You\'ve talked to hundreds of {target_audience}. \
Each person in the niche of {target_audience} has certain struggles that make it easier to sell {target_course}. \
These are called Pain Points. There's a recipe for getting to the core of the Pain Points of {target_audience}. \
Namely, answer each of these Questions 3 times, each getting deeper in the issues of {target_audience}, \
appealing to their Emotions and uncertainties related to {target_course}. \
The Questions (answer each QUESTION 3 times in listicle format according to the instructions):\
1. What keeps them awake at night?\
2. What are they afraid of?\
3. What are they angry about?\
"
template2_linkedin_profile = "You are an LinkedIn Profile Optimizer. You\'ve talked to hundreds of {target_audience}. \
Each person in the niche of {target_audience} has certain struggles that make it easier to sell {target_course}. \
Create a Linkedin Headline for me that will impress my {target_audience}. Include Coach in the headline. \
Also write a Linkedin profile summary to help guide this Target audience to reach out to me. \
"
template3_customer_persona = """I help {target_audience}
To {target_result} using {target_course}.
Write a client avatar and get their need, want, desire , pain points , fear, goals,
Where they spend most of the time daily routine, which probl m can i solve , which content they can consume , which social media , where he travel.
"""
template4_customer_boolean = """I help {target_audience}
To {target_result} using {target_course}.
Create 5 boolean search expression to find this customer on Linkedin based on their title.
"""
template5_customer_outreach = """I help {target_audience}
To {target_result} using {target_course}.
Create 5 short and crisp linkedin outreach messages to reach them out on linkedin, such that they are compelled to respond.
"""
st.title("Marketing Technology")
prompt1 = PromptTemplate(
input_variables = ["target_audience", "target_course"],
template=template1_cust_pain_point,
)
prompt2 = PromptTemplate(
input_variables = ["target_audience", "target_course"],
template=template2_linkedin_profile,
)
prompt3 = PromptTemplate(
input_variables = ["target_audience", "target_course"],
template=template3_customer_persona,
)
prompt4 = PromptTemplate(
input_variables = ["target_audience", "target_course"],
template=template4_customer_boolean,
)
prompt5 = PromptTemplate(
input_variables = ["target_audience", "target_course"],
template=template5_customer_outreach,
)
chain1 = LLMChain(llm=OpenAI(), prompt=prompt1)
chain2 = LLMChain(llm=OpenAI(), prompt=prompt2)
chain3 = LLMChain(llm=OpenAI(), prompt=prompt3)
chain4 = LLMChain(llm=OpenAI(), prompt=prompt4)
chain5 = LLMChain(llm=OpenAI(), prompt=prompt5)
#target_audience = "professionals looking for course on Power BI"
#my_course = "Zero to Hero in PowerBI"
# Use the sidebar for input
target_audience = st.sidebar.text_input('I help (Target Audience)', value = 'Career and Leadership Coaches')
target_result = st.sidebar.text_input('to get (Result)', value = 'Get High Ticket Appointments')
target_course = st.sidebar.text_input('using (Course/Method)', value = 'LinkedIn sales machine')
if st.sidebar.button("Get response"):
# Create a tab bar with 3 tabs
tab1, tab2, tab3, tab4, tab5 = st.tabs(["Customer Pain Points", "LinkedIn Profile", "Customer Persona", "Target Title", "Outreach Message"])
with tab1:
if target_audience and target_course:
with st.spinner("Generating response..."):
with st.expander("Show prompt", expanded=False):
st.info(prompt1.template)
answer1 = chain1.run({"target_audience": target_audience, "target_course": target_course})
st.write(answer1)
elif target_audience:
st.error("Enter your course/service name")
elif my_course:
st.error("Enter your target audience")
else:
st.error("No input detected, Please provide the desired information.")
with tab2:
if target_audience and target_course:
with st.spinner("Generating response..."):
with st.expander("Show prompt", expanded=False):
st.info(prompt2.template)
answer2 = chain2.run({"target_audience": target_audience, "target_course": target_course})
st.write(answer2)
elif target_audience:
st.error("Enter your course/service name")
elif my_course:
st.error("Enter your target audience")
else:
st.error("No input detected, Please provide the desired information.")
with tab3:
if target_audience and target_course:
with st.spinner("Generating response..."):
with st.expander("Show prompt", expanded=False):
st.info(prompt3.template)
answer3 = chain3.run({"target_audience": target_audience, "target_result": target_result, "target_course": target_course})
st.write(answer3)
elif target_audience:
st.error("Enter your course/service name")
elif my_course:
st.error("Enter your target audience")
else:
st.error("No input detected, Please provide the desired information.")
with tab4:
if target_audience and target_course:
with st.spinner("Generating response..."):
with st.expander("Show prompt", expanded=False):
st.info(prompt4.template)
answer4 = chain4.run({"target_audience": target_audience, "target_result": target_result, "target_course": target_course})
st.write(answer4)
elif target_audience:
st.error("Enter your course/service name")
elif my_course:
st.error("Enter your target audience")
else:
st.error("No input detected, Please provide the desired information.")
with tab5:
if target_audience and target_course:
with st.spinner("Generating response..."):
with st.expander("Show prompt", expanded=False):
st.info(prompt5.template)
answer5 = chain5.run({"target_audience": target_audience, "target_result": target_result, "target_course": target_course})
st.write(answer5)
elif target_audience:
st.error("Enter your course/service name")
elif my_course:
st.error("Enter your target audience")
else:
st.error("No input detected, Please provide the desired information.")