KunaalNaik commited on
Commit
b286257
1 Parent(s): c513013

Update app.py

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