Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ from langchain import FewShotPromptTemplate
|
|
5 |
from langchain.prompts.example_selector import LengthBasedExampleSelector
|
6 |
from dotenv import load_dotenv
|
7 |
|
|
|
8 |
|
9 |
def getLLMResponse(query, age_option,tasktype_option):
|
10 |
examples = []
|
@@ -55,15 +56,7 @@ def getLLMResponse(query, age_option,tasktype_option):
|
|
55 |
return response
|
56 |
|
57 |
#UI Starts here
|
58 |
-
|
59 |
-
load_dotenv() # Make sure your .env file path is correct
|
60 |
-
|
61 |
-
# Streamlit App Configuration
|
62 |
-
st.set_page_config(page_title="PitchPal: Your Friendly Copy Assistant",
|
63 |
-
page_icon="💻",
|
64 |
-
layout="wide",
|
65 |
-
initial_sidebar_state="collapsed")
|
66 |
-
|
67 |
# Custom CSS for styling
|
68 |
st.markdown(
|
69 |
"""
|
@@ -81,10 +74,29 @@ st.markdown(
|
|
81 |
</style>
|
82 |
""", unsafe_allow_html=True)
|
83 |
|
84 |
-
|
85 |
-
st.
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
# User Input Section with Improved Layout
|
90 |
col1, col2 = st.columns(2)
|
@@ -95,20 +107,18 @@ with col1:
|
|
95 |
with col2:
|
96 |
tasktype_option = st.selectbox(
|
97 |
'Marketing copy type:',
|
98 |
-
('Twitter post', '
|
99 |
index=1)
|
100 |
age_option = st.selectbox(
|
101 |
-
'
|
102 |
-
('
|
103 |
index=1)
|
104 |
|
105 |
-
# Submit Button for Generating Sales Copy
|
106 |
-
submit = st.button("Generate Sales Copy")
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
|
113 |
-
|
114 |
-
|
|
|
5 |
from langchain.prompts.example_selector import LengthBasedExampleSelector
|
6 |
from dotenv import load_dotenv
|
7 |
|
8 |
+
load_dotenv() # load the env-sample.txt file
|
9 |
|
10 |
def getLLMResponse(query, age_option,tasktype_option):
|
11 |
examples = []
|
|
|
56 |
return response
|
57 |
|
58 |
#UI Starts here
|
59 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
# Custom CSS for styling
|
61 |
st.markdown(
|
62 |
"""
|
|
|
74 |
</style>
|
75 |
""", unsafe_allow_html=True)
|
76 |
|
77 |
+
|
78 |
+
st.set_page_config(page_title="PitchPal: Your Friendly Copy Assistant",
|
79 |
+
page_icon='💻',
|
80 |
+
layout='centered',
|
81 |
+
initial_sidebar_state='collapsed')
|
82 |
+
|
83 |
+
|
84 |
+
st.markdown("<h1 style='text-align: center'>PitchPal</h1>", unsafe_allow_html=True)
|
85 |
+
st.markdown("<h3 style='text-align: center'>Your Efficient Sales Copy Assistant</h2>", unsafe_allow_html=True)
|
86 |
+
st.markdown("<p style='text-align: right'>By <a href='https://entzyeung.github.io/portfolio/index.html'>Lorentz Yeung</a></p>", unsafe_allow_html=True)
|
87 |
+
|
88 |
+
|
89 |
+
#st.title("PitchPal")
|
90 |
+
#st.subheader("Your Friendly Sales Copy Assistant")
|
91 |
+
#st.markdown(
|
92 |
+
# """
|
93 |
+
# - by [Lorentz Yeung]()
|
94 |
+
# """
|
95 |
+
# )
|
96 |
+
|
97 |
+
form_input = st.text_area('Enter the name of the product or service you want to promote: ', 'PlayStation 6', height=100)
|
98 |
+
# st.write(f'You wrote {len(form_input)} characters.')
|
99 |
+
|
100 |
|
101 |
# User Input Section with Improved Layout
|
102 |
col1, col2 = st.columns(2)
|
|
|
107 |
with col2:
|
108 |
tasktype_option = st.selectbox(
|
109 |
'Marketing copy type:',
|
110 |
+
('Draft a Twitter post', 'Draft a sales copy', 'Draft a product description'),
|
111 |
index=1)
|
112 |
age_option = st.selectbox(
|
113 |
+
'Target customers age group:',
|
114 |
+
('below age 18', 'age 18-45', 'age 46-65', 'age > 65'),
|
115 |
index=1)
|
116 |
|
|
|
|
|
117 |
|
118 |
+
# numberOfWords= st.slider('Words limit', 1, 200, 25)
|
119 |
+
numberOfWords = 40 # the new model doesn't support this.
|
120 |
+
|
121 |
+
submit = st.button("Generate Your Sales Copy")
|
122 |
|
123 |
+
if submit:
|
124 |
+
st.write(getLLMResponse(form_input,tasktype_option,age_option))
|