Spaces:
Sleeping
Sleeping
| # ✅ 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() |