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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -46
app.py CHANGED
@@ -1,57 +1,42 @@
1
  import streamlit as st
2
  import openai
3
- import os
4
 
5
  # Access the OpenAI API key from Hugging Face Spaces secrets
6
  openai.api_key = st.secrets["OPENAI_API_KEY"]
7
 
8
- st.title("Comprehensive Lead Generation Plan for 2024")
9
 
10
- # User inputs for creating the lead generation plan
11
- st.subheader("Describe Your Business")
12
- business_description = st.text_area(
13
- "Business Description",
14
- placeholder="Briefly describe your business, including products/services offered."
15
- )
16
 
17
- st.subheader("Target Audience")
18
- target_customers = st.text_area(
19
- "Target Customers",
20
- placeholder="Describe your ideal customers (e.g., demographics, interests)."
21
- )
 
 
 
22
 
23
- st.subheader("Budget and Preferences")
24
- advertising_budget = st.selectbox(
25
- "Advertising Budget",
26
- ["No budget", "Limited budget", "Moderate budget", "Large budget"]
27
- )
28
- additional_details = st.text_area(
29
- "Additional Details",
30
- placeholder="Any specific goals, strategies, or preferences?"
31
- )
 
 
 
32
 
33
- # Function to generate the lead generation plan
34
- def generate_lead_generation_plan(business_description, target_customers, advertising_budget, additional_details):
35
- prompt = (
36
- f"Create a detailed lead generation plan for 2024 for a business with the following details: "
37
- f"Description: {business_description}; Target customers: {target_customers}; "
38
- f"Advertising budget: {advertising_budget}. Additional details: {additional_details}. "
39
- "Include specific ad placements, creative opt-in strategies, video marketing ideas, and AI lead generation tools."
40
- )
41
- response = openai.ChatCompletion.create(
42
- model="gpt-4",
43
- messages=[
44
- {"role": "system", "content": "You are a marketing expert providing detailed lead generation plans."},
45
- {"role": "user", "content": prompt}
46
- ],
47
- max_tokens=700
48
- )
49
- return response.choices[0].message['content']
50
 
51
- # Generate and display the plan
52
- if st.button('Generate Lead Generation Plan'):
53
- plan = generate_lead_generation_plan(
54
- business_description, target_customers, advertising_budget, additional_details
55
- )
56
- st.subheader("Your Customized Lead Generation Plan for 2024:")
57
- st.write(plan)
 
1
  import streamlit as st
2
  import openai
 
3
 
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
26
+ try:
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...