sunbal7 commited on
Commit
bcd2f7a
Β·
verified Β·
1 Parent(s): cf647c5

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -77
app.py DELETED
@@ -1,77 +0,0 @@
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="🎯")
6
-
7
- st.title("πŸš€ Social Media Campaign Ideas Generator")
8
- st.markdown("Generate **5 unique, creative and actionable** campaign ideas for your brand! 🌟")
9
-
10
- # User Inputs
11
- brand = st.text_input("πŸ“ Brand or Product Name")
12
- audience = st.selectbox(
13
- "🎯 Target Audience",
14
- ("Gen Z (18-24)", "Millennials (25-40)", "Gen X (41-56)", "Boomers (57+)", "Parents", "Students", "Professionals")
15
- )
16
- platform = st.selectbox(
17
- "πŸ“± Social Media Platform",
18
- ("Instagram", "Facebook", "TikTok", "YouTube", "LinkedIn", "Pinterest", "Twitter / X")
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", "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")
24
-
25
- # Function to call Groq API (Mixtral model)
26
- def generate_campaign_ideas(brand, audience, platform, goal):
27
- url = "https://api.groq.com/openai/v1/chat/completions"
28
- headers = {
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...
45
- 2. πŸš€ Idea 2...
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)
61
- response.raise_for_status()
62
- result = response.json()
63
- return result['choices'][0]['message']['content']
64
-
65
- # Generate Button
66
- if st.button("✨ Generate 5 Campaign Ideas"):
67
- if not brand or not goal:
68
- st.warning("⚠️ Please enter both the Brand Name and Campaign Goal.")
69
- else:
70
- with st.spinner("πŸ’‘ Generating creative ideas... please wait..."):
71
- try:
72
- output = generate_campaign_ideas(brand, audience, platform, goal)
73
- st.success("πŸŽ‰ Generated 5 unique campaign ideas!")
74
- st.markdown(output)
75
- st.balloons()
76
- except Exception as e:
77
- st.error(f"⚠️ Error: {e}")