KunaalNaik commited on
Commit
c72f44e
1 Parent(s): 76dbc1a

create app.py

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