Spaces:
Sleeping
Sleeping
KunaalNaik
commited on
Commit
•
dfebcfd
1
Parent(s):
7682b4f
Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,36 @@
|
|
1 |
import streamlit as st
|
2 |
from langchain.llms import OpenAI
|
|
|
3 |
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
# Enhanced prompt with additional context for better post generation
|
8 |
-
prompt = (
|
9 |
-
f"Create a professional, engaging LinkedIn post about {topic}. "
|
10 |
-
"It should start with a attention grabbing hook based on audience pain"
|
11 |
-
"Then a line to agitate the user. This should be in the next line"
|
12 |
-
"The post should be concise, informative, and suitable for a professional audience. "
|
13 |
-
"It should provide value, insights, or thought-provoking content related to the topic. "
|
14 |
-
"And only contain 3 points."
|
15 |
-
"The tone should be positive and encouraging, suitable for networking and professional growth."
|
16 |
-
)
|
17 |
-
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
18 |
-
response = llm(prompt)
|
19 |
-
return response
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
post
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from langchain.llms import OpenAI
|
3 |
+
from auth import *
|
4 |
|
5 |
+
if __name__ = '__app__':
|
6 |
+
|
7 |
+
st.title("🔗 LinkedIn Post Generator")
|
8 |
|
9 |
+
st.write(get_login_str(), unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
if st.button("Display User"):
|
12 |
+
display_user()
|
13 |
+
|
14 |
+
def generate_linkedin_post(topic):
|
15 |
+
# Enhanced prompt with additional context for better post generation
|
16 |
+
prompt = (
|
17 |
+
f"Create a professional, engaging LinkedIn post about {topic}. "
|
18 |
+
"It should start with a attention grabbing hook based on audience pain"
|
19 |
+
"Then a line to agitate the user. This should be in the next line"
|
20 |
+
"The post should be concise, informative, and suitable for a professional audience. "
|
21 |
+
"It should provide value, insights, or thought-provoking content related to the topic. "
|
22 |
+
"And only contain 3 points."
|
23 |
+
"The tone should be positive and encouraging, suitable for networking and professional growth."
|
24 |
+
)
|
25 |
+
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
26 |
+
response = llm(prompt)
|
27 |
+
return response
|
28 |
+
|
29 |
+
with st.form("my_form"):
|
30 |
+
topic = st.text_area("Enter the topic for your LinkedIn post:")
|
31 |
+
submitted = st.form_submit_button("Generate Post")
|
32 |
+
if submitted and topic:
|
33 |
+
post = generate_linkedin_post(topic)
|
34 |
+
st.info(post)
|
35 |
+
elif submitted and not topic:
|
36 |
+
st.error("Please enter a topic to generate a post.")
|