AnishaG0201's picture
Update app.py
8e428da verified
raw
history blame
No virus
727 Bytes
import streamlit as st
#from langchain.llms import OpenAI
from langchain_community.llms import OpenAI
st.title("ask me anything!")
def generate_linkedin_post(topic):
# Enhanced prompt with additional context for better post generation
prompt = topic
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
response = llm(prompt)
return response
with 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.")