Spaces:
Build error
Build error
Update app.py
Browse files12345678910111213141516171819202122232425262728293031323334353637import streamlit as st#from langchain.llms import OpenAIfrom langchain_community.llms import OpenAIfrom auth import *if __name__ == '__app__':st.title("🔗 LinkedIn Post Generator")st.write(get_login_str(), unsafe_allow_html=True)if st.button("Display User"):display_user()def generate_linkedin_post(topic):# Enhanced prompt with additional context for better post generationprompt = (f"Create a professional, engaging LinkedIn post about {topic}. ""It should start with a attention grabbing hook based on audience pain""Then a line to agitate the user. This should be in the next line""The post should be concise, informative, and suitable for a professional audience. ""It should provide value, insights, or thought-provoking content related to the topic. ""And only contain 3 points.""The tone should be positive and encouraging, suitable for networking and professional growth.")llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])response = llm(prompt)return responsewith st.form("my_form"):topic = st.text_area("Enter the topic for your LinkedIn post:")submitted = st.form_submit_button("Generate Post")if submitted and topic:post = generate_linkedin_post(topic)st.info(post)elif submitted and not topic:st.error("Please enter a topic to generate a post.")123456789101112131415161718192021222324252627282930import streamlit as st#from langchain.llms import OpenAIfrom langchain_community.llms import OpenAIst.title("🔗 LinkedIn Post Generator")def generate_linkedin_post(topic):# Enhanced prompt with additional context for better post generationprompt = (f"Create a professional, engaging LinkedIn post about {topic}. ""It should start with a attention grabbing hook based on audience pain""Then a line to agitate the user. This should be in the next line""The post should be concise, informative, and suitable for a professional audience. ""It should provide value, insights, or thought-provoking content related to the topic. ""And only contain 3 points.""The tone should be positive and encouraging, suitable for networking and professional growth.")llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])response = llm(prompt)return responsewith st.form("my_form"):topic = st.text_area("Enter the topic for your LinkedIn post:")submitted = st.form_submit_button("Generate Post")if submitted and topic:post = generate_linkedin_post(topic)st.info(post)elif submitted and not topic:st.error("Please enter a topic to generate a post.")
app.py+24-31