nniehaus commited on
Commit
88073e5
·
1 Parent(s): 1c8ff11

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -17
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 Recommender for Marketers")
8
 
9
- # Collecting user input
10
- st.subheader("Tell Us About Your Business")
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 recommendations button
17
- if st.button('Generate AI Lead Magnet Recommendations'):
18
- # Construct the prompt for the AI
19
  prompt_text = (
20
- f"Based on the following details, recommend AI lead magnets suitable for engaging a customer base: "
21
- f"Business type: {business_type}, target audience: {target_audience}, "
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 a marketing expert assistant."},
31
  {"role": "user", "content": prompt_text}
32
  ]
33
  )
34
- recommendations = response_text.choices[0].message['content']
35
  except Exception as e:
36
- recommendations = f"Error in generating recommendations: {e}"
37
 
38
- # Display the recommendations
39
- st.markdown("### AI Lead Magnet Recommendations")
40
- st.write(recommendations)
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...