Spaces:
Runtime error
Runtime error
Delete app3.py
Browse files
app3.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
| 1 |
-
#from langchain.llms import OpenAI
|
| 2 |
-
import streamlit as st
|
| 3 |
-
from langchain_community.llms import OpenAI
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
st.title("🔗 LinkedIn Test Post Generator two options")
|
| 7 |
-
|
| 8 |
-
def generate_linkedin_post(topic):
|
| 9 |
-
# Enhanced prompt with additional context for better post generation
|
| 10 |
-
prompt = (
|
| 11 |
-
f"Create a LinkedIn post about {topic} that grabs attention and makes people chuckle. Here's how:" +
|
| 12 |
-
f"Start with a relatable pain point:** Something the audience groans about inwardly (e.g., 'Ever spend hours on a task that should take minutes?')"+
|
| 13 |
-
f"Agitate with a pinch of absurdity:** Exaggerate the pain point in a slightly ridiculous way (e.g., '...only to discover your cat was sitting on the keyboard the whole time.')"+
|
| 14 |
-
f"***Offer a solution (with a twist):** Provide a real tip but phrase it unexpectedly (e.g., 'Turns out, the answer lies in [insightful tip] - and checking for rogue felines.')"+
|
| 15 |
-
f"***Tone:** Confident, slightly tongue-in-cheek. Aim for a knowing smile, not a belly laugh.")
|
| 16 |
-
llm = OpenAI(temperature=0.7, openai_api_key=st.secrets["OPENAI_API_KEY"])
|
| 17 |
-
response = llm(prompt)
|
| 18 |
-
return response
|
| 19 |
-
|
| 20 |
-
with st.form("my_form"):
|
| 21 |
-
topic = st.text_area("Enter the topic for your LinkedIn post:")
|
| 22 |
-
submitted = st.form_submit_button("Generate Post")
|
| 23 |
-
if submitted and topic:
|
| 24 |
-
post = generate_linkedin_post(topic)
|
| 25 |
-
st.info(post)
|
| 26 |
-
elif submitted and not topic:
|
| 27 |
-
st.error("Please enter a topic to generate a post.")
|
| 28 |
-
|
| 29 |
-
with st.form("my_form1"):
|
| 30 |
-
topic2 = st.text_area("Enter the topic 2 for your LinkedIn post:")
|
| 31 |
-
submitted2 = st.form_submit_button("Generate Post")
|
| 32 |
-
if submitted2 and topic2:
|
| 33 |
-
post = generate_linkedin_post(topic)
|
| 34 |
-
st.info(post)
|
| 35 |
-
elif submitted2 and not topic2:
|
| 36 |
-
st.error("Please enter a topic 2 to generate a post.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|