Update app2.py
Browse files
app2.py
CHANGED
|
@@ -18,10 +18,10 @@ def main():
|
|
| 18 |
temp = st.slider("Temperature", min_value=0.0, max_value=1.0, value=0.7, step=0.1) # Corrected slider label
|
| 19 |
st.write("Selected value:", temp)
|
| 20 |
|
| 21 |
-
def generate_linkedin_post(topic):
|
| 22 |
# Enhanced prompt with additional context for better post generation
|
| 23 |
prompt = (
|
| 24 |
-
f"Create a professional, engaging LinkedIn post about {topic}. "
|
| 25 |
"It should start with a attention grabbing hook based on audience pain. "
|
| 26 |
"Then a line to agitate the user. This should be in the next line. "
|
| 27 |
"The post should be concise, informative, and suitable for a professional audience. "
|
|
@@ -29,7 +29,7 @@ def main():
|
|
| 29 |
"And only contain 3 points. "
|
| 30 |
"The tone should be positive and encouraging, suitable for networking and professional growth."
|
| 31 |
)
|
| 32 |
-
llm = OpenAI(temperature=temp,
|
| 33 |
response = llm(prompt)
|
| 34 |
return response
|
| 35 |
|
|
|
|
| 18 |
temp = st.slider("Temperature", min_value=0.0, max_value=1.0, value=0.7, step=0.1) # Corrected slider label
|
| 19 |
st.write("Selected value:", temp)
|
| 20 |
|
| 21 |
+
def generate_linkedin_post(topic, role):
|
| 22 |
# Enhanced prompt with additional context for better post generation
|
| 23 |
prompt = (
|
| 24 |
+
f" You as {role} Create a professional, engaging LinkedIn post about {topic}. "
|
| 25 |
"It should start with a attention grabbing hook based on audience pain. "
|
| 26 |
"Then a line to agitate the user. This should be in the next line. "
|
| 27 |
"The post should be concise, informative, and suitable for a professional audience. "
|
|
|
|
| 29 |
"And only contain 3 points. "
|
| 30 |
"The tone should be positive and encouraging, suitable for networking and professional growth."
|
| 31 |
)
|
| 32 |
+
llm = OpenAI(temperature=temp, openai_api_key=st.secrets["OPENAI_API_KEY"]) # Corrected variable name
|
| 33 |
response = llm(prompt)
|
| 34 |
return response
|
| 35 |
|