Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,22 +4,19 @@ import openai
|
|
| 4 |
# Access the OpenAI API key from Hugging Face Spaces secrets
|
| 5 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
| 6 |
|
| 7 |
-
st.title("AI Lead Magnet
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
st.subheader("Tell Us About Your
|
| 11 |
business_type = st.text_input("Business Type", placeholder="e.g., Real Estate, E-commerce")
|
| 12 |
target_audience = st.text_area("Target Audience", placeholder="Describe your primary customer base")
|
| 13 |
-
current_marketing_strategies = st.text_area("Current Marketing Strategies", placeholder="Your current marketing efforts")
|
| 14 |
-
business_goals = st.text_area("Business Goals and Challenges", placeholder="What do you aim to achieve with the lead magnet?")
|
| 15 |
|
| 16 |
-
# Generate
|
| 17 |
-
if st.button('Generate AI Lead Magnet
|
| 18 |
-
# Construct the prompt for
|
| 19 |
prompt_text = (
|
| 20 |
-
f"
|
| 21 |
-
f"
|
| 22 |
-
f"current marketing strategies: {current_marketing_strategies}, business goals: {business_goals}."
|
| 23 |
)
|
| 24 |
|
| 25 |
# Call the OpenAI API for text generation
|
|
@@ -27,16 +24,16 @@ if st.button('Generate AI Lead Magnet Recommendations'):
|
|
| 27 |
response_text = openai.ChatCompletion.create(
|
| 28 |
model="gpt-4",
|
| 29 |
messages=[
|
| 30 |
-
{"role": "system", "content": "You are
|
| 31 |
{"role": "user", "content": prompt_text}
|
| 32 |
]
|
| 33 |
)
|
| 34 |
-
|
| 35 |
except Exception as e:
|
| 36 |
-
|
| 37 |
|
| 38 |
-
# Display the
|
| 39 |
-
st.markdown("### AI Lead Magnet
|
| 40 |
-
st.write(
|
| 41 |
|
| 42 |
# Rest of your Streamlit code...
|
|
|
|
| 4 |
# Access the OpenAI API key from Hugging Face Spaces secrets
|
| 5 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
| 6 |
|
| 7 |
+
st.title("AI Lead Magnet Idea Generator for Marketers")
|
| 8 |
|
| 9 |
+
# User inputs for the marketing plan
|
| 10 |
+
st.subheader("Tell Us About Your Target Audience")
|
| 11 |
business_type = st.text_input("Business Type", placeholder="e.g., Real Estate, E-commerce")
|
| 12 |
target_audience = st.text_area("Target Audience", placeholder="Describe your primary customer base")
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# Generate AI lead magnet ideas button
|
| 15 |
+
if st.button('Generate AI Lead Magnet Ideas'):
|
| 16 |
+
# Construct the prompt for AI lead magnet ideas
|
| 17 |
prompt_text = (
|
| 18 |
+
f"Generate ideas for AI-based lead magnets that a {business_type} company can offer to their target audience: {target_audience}. "
|
| 19 |
+
f"Focus on interactive and engaging AI-driven tools or content that can attract and provide value to their customers."
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
# Call the OpenAI API for text generation
|
|
|
|
| 24 |
response_text = openai.ChatCompletion.create(
|
| 25 |
model="gpt-4",
|
| 26 |
messages=[
|
| 27 |
+
{"role": "system", "content": "You are an assistant who specializes in marketing and AI applications."},
|
| 28 |
{"role": "user", "content": prompt_text}
|
| 29 |
]
|
| 30 |
)
|
| 31 |
+
lead_magnet_ideas = response_text.choices[0].message['content']
|
| 32 |
except Exception as e:
|
| 33 |
+
lead_magnet_ideas = f"Error in generating AI lead magnet ideas: {e}"
|
| 34 |
|
| 35 |
+
# Display the AI lead magnet ideas
|
| 36 |
+
st.markdown("### AI Lead Magnet Ideas")
|
| 37 |
+
st.write(lead_magnet_ideas)
|
| 38 |
|
| 39 |
# Rest of your Streamlit code...
|