sunbal7 commited on
Commit
0632373
Β·
verified Β·
1 Parent(s): 5c551fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -11
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import streamlit as st
2
  import requests
3
- import os
4
 
5
  # Set Streamlit page config
6
  st.set_page_config(page_title="πŸš€ Campaign Idea Generator", page_icon="🎯")
@@ -20,7 +19,7 @@ platform = st.selectbox(
20
  )
21
  goal = st.text_area("🎯 Campaign Goal", placeholder="e.g., Increase brand awareness, drive engagement...")
22
 
23
- # Load API Key (set this in your Huggingface or local secrets)
24
  GROQ_API_KEY = st.secrets.get("GROQ_API_KEY", "YOUR_GROQ_API_KEY")
25
 
26
  # Function to call Groq API (Mixtral model)
@@ -30,8 +29,16 @@ def generate_campaign_ideas(brand, audience, platform, goal):
30
  "Authorization": f"Bearer {GROQ_API_KEY}",
31
  "Content-Type": "application/json"
32
  }
33
- system_prompt = "You are a professional social media marketing expert. Generate 5 unique, creative, and actionable campaign ideas. Each idea should suggest post formats, influencer collaboration, and engagement tips. Use fun and engaging language with emojis."
34
- user_prompt = f"""Generate exactly 5 creative social media campaign ideas for brand '{brand}', targeting '{audience}' on '{platform}'.
 
 
 
 
 
 
 
 
35
  Goal: {goal}.
36
  Format ideas clearly as:
37
  1. 🎯 Idea 1...
@@ -39,16 +46,15 @@ Format ideas clearly as:
39
  3. 🌟 Idea 3...
40
  4. πŸŽ‰ Idea 4...
41
  5. πŸ’‘ Idea 5...
42
- Make sure each idea is unique and actionable."""
43
 
44
- data = {
45
- "model": "mixtral-8x7b-32768", # Best for marketing ideas + super fast
46
- "messages": [
47
- {"role": "system", "content": system_prompt},
48
- {"role": "user", "content": user_prompt}
49
  ],
50
  "temperature": 0.7,
51
- "max_tokens": 800
 
 
 
52
  }
53
 
54
  response = requests.post(url, headers=headers, json=data)
 
1
  import streamlit as st
2
  import requests
 
3
 
4
  # Set Streamlit page config
5
  st.set_page_config(page_title="πŸš€ Campaign Idea Generator", page_icon="🎯")
 
19
  )
20
  goal = st.text_area("🎯 Campaign Goal", placeholder="e.g., Increase brand awareness, drive engagement...")
21
 
22
+ # Load API Key
23
  GROQ_API_KEY = st.secrets.get("GROQ_API_KEY", "YOUR_GROQ_API_KEY")
24
 
25
  # Function to call Groq API (Mixtral model)
 
29
  "Authorization": f"Bearer {GROQ_API_KEY}",
30
  "Content-Type": "application/json"
31
  }
32
+ data = {
33
+ "model": "mixtral-8x7b-32768",
34
+ "messages": [
35
+ {
36
+ "role": "system",
37
+ "content": "You are a professional social media marketing expert. Generate exactly 5 unique, creative, and actionable campaign ideas. Each idea should suggest post formats, influencer collaboration, and engagement tips. Use fun and engaging language with emojis."
38
+ },
39
+ {
40
+ "role": "user",
41
+ "content": f"""Generate exactly 5 creative social media campaign ideas for brand '{brand}', targeting '{audience}' on '{platform}'.
42
  Goal: {goal}.
43
  Format ideas clearly as:
44
  1. 🎯 Idea 1...
 
46
  3. 🌟 Idea 3...
47
  4. πŸŽ‰ Idea 4...
48
  5. πŸ’‘ Idea 5...
 
49
 
50
+ Each idea must be actionable and unique."""
51
+ }
 
 
 
52
  ],
53
  "temperature": 0.7,
54
+ "max_tokens": 800,
55
+ "top_p": 0.95,
56
+ "frequency_penalty": 0,
57
+ "presence_penalty": 0
58
  }
59
 
60
  response = requests.post(url, headers=headers, json=data)