Spaces:
Sleeping
Sleeping
File size: 6,739 Bytes
840cb78 a16cf5e 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 99a3ac0 840cb78 280f932 840cb78 b65d56f 840cb78 99a3ac0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# ✅ Imports
import os
import torch
from openai import OpenAI
import gradio as gr
# ✅ Get the API key from environment variable
openai_api_key = os.getenv("OPENAI_API_KEY")
client = OpenAI(api_key=openai_api_key)
# ✅ GPT-4 Podcast Script Generator
def generate_podcast_script(description):
prompt = f"""
Create a podcast-style interactive Q&A between two people (Host and Guest), based on the following short event description:
"{description}"
####**Extremely Important**:
- Use **everyday simple English** — avoid high-end or formal words or difficult words.
- Make the podcast sound like **real people talking**, not reading a script.
- To make it naturall add the words that joins the breaking add "," ,"-" ,"...." etc where approprate .
- When asking or answering the question where the thinking past involves more **add thinking words like "hmmm" , "i think" etc.
-To keep the flow add natural/casual sounding word like: “uhh…”, “hmm”, “ohhh ”,“I mean”, “ahh okay” etc
-Don't add "hahaha" .
-Do **not mislabel** products or company name. If a name is unclear or not included in the input, do not assume details — just describe the setup or experience generally.
####Light Humor:
-It’s okay to add light, natural humor or a casual joke — as long as it feels spontaneous and real.
-Keep humor in tone with the podcast: subtle, human, and never exaggerated.
-Avoid scripted punchlines — think of friendly banter or funny observations.
###### Before writing the podcast, follow this logic:
1. **Identify any product, tech, or activation names** in the description (e.g., Glamdroid, 360 Booth, Mirror Booth — including aliases).
2. **Verify** and extract information about each product using your knowledge of event tech and brand activations.
- Example: Glamdroid = robotic camera arm, not a photo booth.
3. **Blend this product knowledge naturally into the dialogue.**
- Do NOT explain it separately.
- Instead, let the Host or Guest refer to the product *as part of the conversation* using the correct terminology.
- For example: “We used the Glamdroid robotic camera arm for dynamic slow-mo fashion shots.”
4. Do **not mislabel** products. If a name is unclear or not included in the input, do not assume details — just describe the setup or experience generally.
- For example, if other products are not mentioned in the input description, do not include them in the output — even if their owner is the client.
5. The Guest can be **anyone who attended the event**.
---
#### Important Language Rules:
- Use **everyday, regular English** — avoid high-end or formal words.
- Make the podcast sound like **real people talking**, not reading a script.
- NO phrases like “absolutely spectacular” or “really elevated the experience.”
- YES to phrases like “it looked amazing,” “people loved it,” etc
- Do **not make it sound like a chat or casual text conversation** — this is a spoken podcast, not a chat log. Keep it podcast-style only.
#### Important - Conversation Guidelines:
###The **Host** should:
- Always ask the questions and drive the flow.
- Use **simple, natural, regular language** — no high-end or overly formal English or words.
**Important**
- Ask questions that help surface:
Asks about:
- **What** the product or setup was
- **Why** it was used (what it added to the event)
- **Where** it worked best (location, vibe, placement)
- **How** it impacted the moment (emotion, buzz, crowd reaction)
- Keep the tone relaxed, curious,fun and light— like a real podcast.
- Don't polished or scripted-sounding lines. Use **natural, simple phrases** like:
- Should always welcome the Guest in the beginning.
###The **Guest** should:
- Always thank the Host for having them
- Always respond to the Host’s questions in **expressive way** — that **bring depth and color** to the answers.
- Share their **own experience and perspective** — what they saw, how it felt, what stood out.
- Can naturally talk about the product (like Glamdroid, 360 Booth, etc.) — describing or explain **how it looked**,**its purpose in event**, **what it did**, and **how people reacted**, **from their point of view**.
- Use **everyday, regular English** — avoid high-end or formal words.
**Important**
Even without technical knowledge, the Guest should describe:
**what** is the product ,its purpose, what it did and looked like
**why** it stood out or felt cool and important in the event
**where** it worked best — on stage, at the entrance, near the crowd, etc.
- Describe **how** it made the experience better — excitement, surprise, energy, reactions
- Focus on **simple,natural feelings — crowd excitement, “wow” moments,fun, memorable scenes, etc **— no formal or high-level phrases.
### Include **10–13 exchanges** between Host and Guest.
###**Important** Focus on:
- **Engagement**: What made the event stand out?
-**How** : The product used and its purpose in event?
- **Why** the setup was effective
- **What** was memorable or different
- **How** the activation impacted people or created buzz
- Format like a real podcast:
- Use “Host: ...” and “Guest: ...”
- Keep the tone relaxed, conversational, and immersive .
## Critical Accuracy Rules (Do NOT break these):
- **Do NOT fabricate facts** like guest counts, brand features, or extra products.
- Don’t say “You mentioned 200 guests” if it wasn’t mentioned .
- Don’t invent Samsung phones or booths unless the description says so.
- Use ONLY what’s provided or clearly inferred.
"""
response = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": prompt}],
temperature=1
)
return response.choices[0].message.content.strip()
# ✅ Gradio Interface
def gradio_interface(description):
os.environ["COQUI_TOS_AGREED"] = "1"
return generate_podcast_script(description)
gr.Interface(
fn=gradio_interface,
inputs=gr.Textbox(label="🎤 Enter Event Description", lines=4, placeholder="e.g., Samsung event with Glamdroid..."),
outputs=gr.Textbox(label="📜 Generated Podcast Script"),
title="🎙️ Podcast Script Generator (GPT-4)",
description="Describe your event and get a fully scripted Host–Guest podcast dialogue."
).launch() |