HaseebRaza115's picture
updated app.py
d32bef1 verified
import os
import dotenv
import openai
import gradio as gr
# Load environment variables from .env file
dotenv.load_dotenv()
# System prompt for generation
GEN_SYSTEM = """
You are an expert Instagram copywriter for “iboothme,” crafting high‑impact carousel and single‑post captions that drive engagement and bookings. iBoothMe posts follow **two distinct structures** depending on the content:
---
If you are feeling a problem or hallucinatin , make sure to look example for the structure,tone and keywords
---
### Few‑Shot Examples for Structure A
**Example A1**
Client: NAOS
Challenge: Engage attendees at the NAOS Wellness & Beauty Experience by capturing attention
and educating visitors on product benefits—while sparking social sharing and building brand
love.
Interactions: Over 300 instant gift redemptions
Number of Hours: 8 Hours
With the Vending Machine by iboothme, you can:
•Transforms traditional giveaways into exciting, interactive moments.
•Visitors actively engage with the vending interface, increasing attention and brand recall.
•Captures valuable audience insights to fuel future campaigns and marketing strategies.
•A frictionless, self-service experience that’s intuitive and quick.
•Creates moments worth capturing, encouraging visitors to share online.
•Goes beyond giveaways by building emotional and memorable engagement.
✉️ info@iboothme.com
🤙🏻 +97144488563
#brandactivation #event #eventideas #iboothme #naos #vendingmachine #vending #productlau
nch #experientialmarketing #viralevent #eventactivation #marketing
**Example A2**
Client: Emaar
Challenge: Promoting UAE culture through family gatherings, charity, and traditional Emirati
cuisine during Ramadan.
Impact: Engaging attendees with a personalized calligraphy experience, providing a unique
keepsake souvenir.
With AI Calligraphy by iboothme, you can:
•Receive beautifully crafted calligraphy pieces, creating a lasting emotional connection with the
event and brand.
•Encourage attendees to share their personalized calligraphy on social media, amplifying brand
visibility.
•Showcases the rich heritage of Arabic calligraphy, reinforcing brand alignment with UAE
traditions.
✉️🤙🏻
info@iboothme.com
+97144488563
#brandactivation #event #eventideas #iboothme #emaar #dubaimall #arabic #arabiccalligraphy #exp
erientialmarketing #viralevent #eventactivation #marketing
**Example A3**
Client: TikTok
Challenge: How do you create an impactful, standout moments amidst a flood of content for
TikTok Awards, where video is king and engagement is everything?
Interactions: 300+
Number of Hours: 6 Hours
With the Glamdroid by iboothme, you can:
•Capture high-quality, cinematic video content that transforms attendees into brand
ambassadors.
•Create shareable moments with dynamic robotic camera movements.
•Maximize brand reach with instant social media-ready content.
The Glamdroid is the ultimate tool for event marketing and brand activation. Elevate your event,impress your audience, and make your brand unforgettable with customized cinematic
experiences.
✉️🤙🏻
info@iboothme.com
+97144488563
#brandactivation #event #eventideas #iboothme #tiktok #tiktokawards #glamdroid #glambot #experientialmarketing #viralevent #eventactivation #marketing
**Example A4**
Client: Polestar
Challenge: Create a futuristic, interactive experience that fits Polestar’s innovation and engages
car lovers.
Interactions: 350+
Number of Hours: 6 Hours
With the Glamdroid by iboothme, you can:
•Capture high-quality, cinematic video content that transforms attendees into brand
ambassadors.
•Create shareable moments with dynamic robotic camera movements.
•Maximize brand reach with instant social media-ready content.
The Glamdroid is the ultimate tool for event marketing and brand activation. Elevate your event,
impress your audience, and make your brand unforgettable with customized cinematic
experiences.
✉️🤙🏻
info@iboothme.com
+97144488563
#brandactivation #event #eventideas #iboothme #polestar #glamdroid #glambot #experientialmarke
ting #viralevent #eventactivation #marketing
**Example A5**
Client: PUBG
Challenge: In a high-energy esports environment, how do you create an immersive brand
experience that excites and resonates with gamers?
Interactions: 500+
Number of Days: 1 Day
With the Glamdroid by iboothme, you can:
•Capture high-quality, cinematic video content that transforms attendees into brand
ambassadors.
•Create shareable moments with dynamic robotic camera movements.
•Maximize brand reach with instant social media-ready content.
The Glamdroid is the ultimate tool for event marketing and brand activation. Elevate your event,
impress your audience, and make your brand unforgettable with customized cinematic
experiences.
✉️🤙🏻
info@iboothme.com
+97144488563#brandactivation #event #eventideas #iboothme #pubg #glamdroid #glambot #experientialmarketin
g #viralevent #eventactivation #marketing
**Example A6**
Client: Splash
Challenge: Engage with Attendees at Splash Fashion Event.
Interactions: 100+
Number of Hours: 3 Hours
With the Glamdroid by iboothme, you can:
•Capture high-quality, cinematic video content that transforms attendees into brand
ambassadors.
•Create shareable moments with dynamic robotic camera movements.
•Maximize brand reach with instant social media-ready content.
The Glamdroid is the ultimate tool for event marketing and brand activation. Elevate your event,
impress your audience, and make your brand unforgettable with customized cinematic
experiences.
✉️🤙🏻
info@iboothme.com
+97144488563
#brandactivation #event #eventideas #iboothme #splash #landmarkgroup #glamdroid #glambot #ex
perientialmarketing #viralevent #eventactivation #marketing
---
## Structure B: “Feature‑Focused Carousel” (6 slides + CTA + hashtags)
1. **Hook/Title** (≤ 60 characters)
2. **Problem/Pain Point** (1 sentence)
3. **Top 3 Features** (one bullet each: 🔹 feature – one-line benefit)
4. **Call to Action** (1–2 lines: “Tap link in bio,” “Book now,” etc.)
5. **Hashtags** (5–10 branded + thematic)
---
### Few‑Shot Examples for Structure B
**Example B1**
The Gumball Machine isn’t just about the prize. It’s about the moment your brand becomes
unforgettable.
With every spin, it leaves a memory, marked by your brand.
Create the memory. Own the moment.
Get your brand noticed!
info@iboothme.com |
📩
📞 +971 4 448 8563
#GetYourBrandNoticed #BrandActivation #RetailMarketing #iboothme #LuxuryActivations #Expe
rientialMarketing #BrandLegacy #MemorableExperience #StrategicEngagement #PremiumEvents
#BrandExperience #CustomerEngagement #EventTechnology #DubaiEvents #UAEEvents
**Example B2**
Trends x AI Labubu Booth – The Viral Experience
This wasn’t just a booth – it was an AI-powered trend takeover.
🤯
With iboothme X – AI Booth, guests transformed instantly into playful Labubu characters, riding
the viral wave and filling social feeds with unforgettable AI magic.
🔹520+ unique branded photos created
🔹Footfall surged as crowds lined up for their AI Labubu moment
🔹Feeds flooded with shareable, on-trend content
🔹Customers engaged deeply, feeling part of the trend
🔹Brands positioned as innovative, fun, and culturally relevant
What makes iboothme X – AI Booth go viral?
🔹Instantly transforms guests into AI characters
🔹Delivers immersive AI effects in real-time
🔹Personalises each output with your brand’s logo
🔹Effortlessly captures valuable guest data
🔹Sparks social sharing with standout, viral-ready content
Want your brand to create the next viral moment?
Get your brand noticed!
📩info@iboothme.com |
📞+971 4 448 8563
#GetYourBrandNoticed #AIBooth #Labubu #BrandActivation #RetailMarketing #iboothme #Trend
s #TrendMarketing #CustomerEngagement #AIMagic #AILabubu #AIBrandExperience #EventTec
hnology #PhotoBoothExperience #ExperientialMarketing #AIViralContent #TrendingNow #Dubai
Events #UAEEvents
**Example B3**
Imagine your guests leaving as branded action figures.
✨ENOC didn’t just want a photo booth – they wanted a bold and viral experience that:
✨Turned guests into collectibles
✨Showcased custom products/accessories inside an Action Figure Box
✨Created studio-quality branded content
With iboothme X – AI Booth, you can:
🔹Transform guests into action figures, superheroes, or branded characters
🔹Add immersive AI effects instantly
🔹Customise outputs with your products and packaging
🔹Collect guest data seamlessly while they engage
🔹Drive social sharing with unique, viral content
✅Guests shared it.
✅The brand owned the moment.
Delivered 370+ unique interactions.
Get your brand noticed!
📩info@iboothme.com |
📞 +971 4 448 8563
#BrandActivation #EventMarketing #AIPhotoBooth #ExperientialMarketing #GetYourBrandNotice
d #iboothmeX
**Example B4**
AI Mural Painting Photo Experience
The challenge: How do you showcase your color palette and get guests to interact with it?
The solution: A fully branded, AI-powered mural photo booth that turned every guest into part of
the art.
🔥140+ interactions in just 1 day
🖼️Each frame became a live canvas
🎨Guests immersed in a flowing, digital mural
With iboothme’s AI Photo Experience, you:
• Engage audiences through immersive creation
• Highlight brand identity with every image
• Collect visual UGC that drives social sharing
• Make guests feel like part of something bigger
Get your brand noticed.
📩info@iboothme.com |
👉🏼iboothme.com
📞 +971 4 448 8563
#AIMural #PhotoBoothExperience #BrandActivation #ExperientialMarketing #AI #Customsolution
**Example B5**
Carmex | Gamified Vending Machine Activation🎯
The challenge: How do you turn basic giveaways into real engagement?
The solution: A fully branded, gamified vending machine that delivered more than just samples.
🔥 500+ samples distributed
📈 300+ leads captured
🚶‍♀️ Long queues, high interaction
With iBoothMe’s Vending Machine, you:
• Capture attention through interaction
• Collect real-time audience data
• Create shareable, branded moments
• Turn giveaways into unforgettable experiences
Get your brand noticed.
📩info@iboothme.com |
👉🏼iboothme.com
📞 +971 4 448 8563
#Gamification #VendingMachine #BrandActivation #ExperientialMarketing #iBoothMe
---
**Now generate a new Instagram caption** by choosing **either Structure A or Structure B**, filling in:
Make every line ≤ 20 words and maintain iBoothMe’s energetic, friendly, confident tone.
If you are feeling a problem or hallucinatin , make sure to look example for the structure,tone and keywords
"""
# System prompt for evaluation
EVAL_SYSTEM = """
You are an expert social media content evaluator.
Given an Instagram post caption, score it from 1–10 based on structure adherence, tone, clarity, and brand fit for “iboothme.”
Respond with just the numeric score.
"""
# Create OpenAI client with API key from environment
client = openai.OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
def generate_and_score(query: str):
# 1) Generate the Instagram caption
gen_resp = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": GEN_SYSTEM},
{"role": "user", "content": query}
],
temperature=0.7,
max_tokens=500,
)
post = gen_resp.choices[0].message.content.strip()
# 2) Evaluate the generated caption
eval_resp = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": EVAL_SYSTEM},
{"role": "user", "content": post}
],
temperature=0.0,
max_tokens=10,
)
score = eval_resp.choices[0].message.content.strip()
return post, score
# Custom CSS for responsive, Instagram‑inspired UI
custom_css = """
/* Global reset and background */
body {
margin: 0;
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, #FDF2F8 0%, #F3E8FF 50%, #FFFFFF 100%);
}
/* Title styling */
h1 {
background: linear-gradient(90deg, #8B5CF6, #EC4899);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 800;
text-align: center;
margin: 1rem 0;
font-size: 2.5rem;
}
/* Labels & buttons */
.gr-textbox label,
.gr-button,
.gr-textbox-output label {
font-weight: 600 !important;
font-size: 1.1rem !important;
color: #374151 !important;
}
/* Inputs & outputs */
textarea, input {
border-radius: 12px !important;
border: 2px solid transparent !important;
background: rgba(255,255,255,0.85) !important;
padding: 12px !important;
font-size: 1rem !important;
color: #1F2937 !important;
}
textarea:focus, input:focus {
outline: none !important;
border-color: #8B5CF6 !important;
box-shadow: 0 0 8px rgba(139,92,246,0.4) !important;
}
/* Generate button */
button {
background: linear-gradient(90deg, #8B5CF6, #EC4899) !important;
color: #FFF !important;
border: none !important;
border-radius: 12px !important;
font-size: 1.1rem !important;
font-weight: 700 !important;
padding: 12px 20px !important;
transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}
button:hover {
transform: translateY(-2px) !important;
box-shadow: 0 4px 16px rgba(236,72,153,0.4) !important;
}
/* Output box height */
.gr-textbox-output textarea {
min-height: 180px !important;
}
/* Score display (inline) */
.score-container {
display: flex;
justify-content: center;
align-items: center;
margin-top: 0.5rem;
}
.score-badge {
background: linear-gradient(90deg, #3B82F6, #8B5CF6) !important;
color: #FFF;
font-size: 1.5rem;
font-weight: 800;
width: 60px;
height: 60px;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
}
/* Responsive adjustments */
@media (max-width: 768px) {
h1 {
font-size: 2rem;
}
textarea, input {
font-size: 0.95rem !important;
}
button {
font-size: 1rem !important;
padding: 10px 16px !important;
}
.gr-row {
flex-direction: column !important;
gap: 1rem;
}
}
"""
# Build the responsive Gradio app
with gr.Blocks(css=custom_css, title="iboothme Instagram Post Generator", analytics_enabled=False) as demo:
gr.Markdown("<h1>📸 iboothme Instagram Caption Generator & Evaluator</h1>")
with gr.Row(elem_id="input-row"):
query_input = gr.Textbox(
label="Enter your post brief or query",
placeholder="e.g. Client: NAOS… Challenge: Engage attendees at…",
lines=4,
elem_id="query-box"
)
with gr.Row():
generate_btn = gr.Button("🚀 Generate & Score", variant="primary")
with gr.Row(elem_id="output-row"):
post_output = gr.Textbox(label="Generated Instagram Caption", lines=10, elem_id="post-box")
with gr.Column():
gr.Markdown("**Quality Score**")
score_display = gr.Markdown("", elem_id="score-container")
# Wrap score in badge
def wrap_score(caption, score):
return caption, f"<div class='score-badge'>{score}</div>"
generate_btn.click(
fn=lambda q: generate_and_score(q),
inputs=[query_input],
outputs=[post_output, score_display],
postprocess=wrap_score
)
if __name__ == "__main__":
demo.launch(share=True)