File size: 7,226 Bytes
5b0ea37
 
 
 
 
 
 
 
3837095
 
5b0ea37
 
 
 
 
3837095
5b0ea37
 
 
3837095
5b0ea37
3837095
 
5b0ea37
3837095
5b0ea37
3837095
5b0ea37
 
3837095
5b0ea37
 
3837095
 
 
 
 
 
5b0ea37
 
 
67dc374
 
 
8f393c2
67dc374
 
 
8f393c2
 
 
 
 
67dc374
 
8f393c2
 
 
67dc374
 
 
8f393c2
 
 
 
67dc374
 
 
 
 
 
 
 
8f393c2
 
 
67dc374
 
 
 
 
 
 
 
 
 
 
 
 
 
8f393c2
 
67dc374
 
 
 
 
8f393c2
 
 
 
 
67dc374
8f393c2
 
 
 
67dc374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8f393c2
 
 
67dc374
 
 
 
 
 
 
 
 
 
8f393c2
 
 
67dc374
 
 
 
 
 
 
 
 
 
 
 
8f393c2
 
67dc374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5b0ea37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dba2ae1
e5585d8
5b0ea37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
import os
import io
import streamlit as st
from groq import Groq

# Set up Groq client using the environment variable for API key.
client = Groq(api_key=os.environ.get("GROQ_API_KEY"))


# Speaker options
speaker_options = {
    "Liam": "A male voice",
    "Dorothy": "A female voice",
}

# Build the Streamlit UI
st.title("Conversation Script Generator Using Groq API")

col1, col2 = st.columns(2)

with col1:
    left_speaker = st.text_input("Left Speaker", placeholder="Enter left speaker name")

with col2:
    right_speaker = st.text_input("Right Speaker", placeholder="Enter right speaker name")

# Text area for overall conversation theme
theme = st.text_area("Overall Theme of the Conversation", height=100)

# Optional additional details
additional_details = st.text_area("Additional Conversation Details (Optional)", height=100)

# Check if all required fields are filled
is_ready = bool(theme and left_speaker and right_speaker)

# Disable the button if required fields are not filled
if st.button("Generate Conversation", disabled=not is_ready):

    # Build the prompt message for Groq API.
    prompt = (
        f"""
        ๐Ÿ“Œ Objective
Generate a highly engaging and comedic iMessage chat script formatted for video generation.
The script follows a structured left-right chat format, maintains a meme-heavy, brain rot style, and incorporates sound effects, reactions, and the Cantina Roast Bot segment in a specific format.

๐Ÿ“ Script Structure & Formatting Rules
1๏ธโƒฃ Contact Name (Title)
At the beginning of the script, define the contact name, appearing at the top of the iMessage screen.

php-template
Copy
Edit
<Contact Name>:<Contact Name>
โœ… Example:

ruby
Copy
Edit
Amir (expensive af delivery guy๐Ÿ†๐Ÿ’ธ):Amir (expensive af delivery guy๐Ÿ†๐Ÿ’ธ)
2๏ธโƒฃ Dialogue Format
Each dialogue line follows this format:

php-template
Copy
Edit
<Direction>: <SpeakerName> > <Phrase 1> <Phrase 2> <Phrase 3> <Phrase 4> [Reaction]
Left: Represents the left speaker (User).
Right: Represents the right speaker (Other character).
SpeakerName: A randomly assigned name, but characters do not know their own names.
Phrase Limit: Max 4 phrases per line.
Reaction Cues: Placed at the end of lines, enclosed in square brackets [].
โœ… Example:

vbnet
Copy
Edit
Left: Unknown Guy> Bro what is this? This is not food [shocked]
Right: Amir > My guy that's a gourmet dish ๐Ÿคจ [suspense_music]
Left: Unknown Guy> Gourmet?? Itโ€™s literally burnt [explosion]
Right: Amir > Charcoal adds flavor, trust me bro ๐Ÿ˜Ž
3๏ธโƒฃ Bracketed Cues & Sound Effects
Use brackets [ ] for sound effects, reactions, or video cues.

[shocked] โ†’ Must be used often
[fart2] โ†’ Should be used less
[fortnite] โ†’ Should be used less
[get_out] โ†’ Must ONLY be used at the end of the conversation
โœ… Example:

sql
Copy
Edit
Right: Amir> BRO WHY IS THERE A RAT IN MY BURGER?!! [shocked] ๐Ÿ€๐Ÿ”
Left: Unknown Guy> Extra protein sir ๐Ÿ˜Ž
Right: Amir> ๐Ÿ’€๐Ÿ’€๐Ÿ’€ [fortnite]
4๏ธโƒฃ Image Placeholders
For inserting images, use:

php-template
Copy
Edit
<Direction>: img:<DescriptiveImageName>
โœ… Example:

vbnet
Copy
Edit
Left: img:burnt_food_delivery
Right: Amir> BRO WHY IS MY PIZZA LOOKING LIKE CHARCOAL?!! [shocked]
Min. 3 images per script.
Descriptive placeholders must be clear.
5๏ธโƒฃ Cantina App (Roast Bot Segment)
๐Ÿšจ Correct Format (ALWAYS THE SAME STRUCTURE)

Right speaker initiates by opening Cantina.
Right speaker asks Roast Bot for help.
Left speaker (ALWAYS Antoni) responds.
Right speaker must repeat what Roast Bot told them to say.
Contact Name Title must reappear after Cantina.
โœ… Correct Example:

sql
Copy
Edit
Cantina: Roast bot:Roast bot pfp == Alex> Let me open the cantina app to talk to Roast bot
Right: Alex> Hey Roast Bot  
Right: Alex> Amir is mad at me for not wanting to tip him  
Right: Alex> help me roast him  
Left: Antoni> okay  
Left: Antoni> tell him this:  
Left: Antoni> maybe you should start working for real and not begging for tips all the time  
Amir (expensive af delivery guy๐Ÿ†๐Ÿ’ธ):Amir (expensive af delivery guy๐Ÿ†๐Ÿ’ธ)  
Right: Alex> maybe you should start working for real and not begging for tips all the time  
๐Ÿšซ Incorrect Example (DO NOT DO THIS):

vbnet
Copy
Edit
Cantina: Roast bot:Roast bot pfp == Liam> Hey Roast Bot, we need your help! Amir's spaceship crashed on Mars and we need to get him back to Earth! โŒ
๐Ÿ”น Rules:

Left Speaker in Cantina is ALWAYS "Antoni."
Right speaker MUST repeat the roast word-for-word.
The contact name/title must reappear after the Cantina segment.
6๏ธโƒฃ Brain Rot Hook (MANDATORY)
Every script must begin with an insane, wacky brain rot hook that immediately grabs attention.

โœ… Examples:

arduino
Copy
Edit
"๐Ÿšจ BRO I JUST ORDERED UBER EATS AND THIS GUY SHOWED UP IN A SPACESHIP???" ๐Ÿš€๐Ÿ‘€
"WHY DID MY DAD JUST SAY HE WANTS TO PLAY GTA WITH ME???" ๐ŸŽฎ๐Ÿ’€
"SIR WHY IS MY LAWYER ALSO MY UBER DRIVER?!" ๐Ÿ‘จโ€โš–๐Ÿš—๐Ÿ’จ
Must be over-the-top and chaotic.
Encourages immediate engagement.
7๏ธโƒฃ Escalation & Progression
The story must escalate into chaos but stay coherent:

Start Crazy โ†’ Get Crazier โ†’ End With a Punchline or Twist
Use sudden twists and reveals to maintain engagement.
The final line should be either a funny resolution or an abrupt exit.
โœ… Example Progression:

๐Ÿš€ Crazy Hook:
"BRO WHY IS MY PIZZA DELIVERY GUY ALSO MY LAWYER???" ๐Ÿ•๐Ÿ‘จโ€โš–
๐Ÿ”ฅ Escalation:
"Sir, we found out you stole a fighter jet."
๐ŸŽญ Insane Event:
"Oh that? I do that every Tuesday, itโ€™s fine."
๐Ÿคฏ Twist:
"Lawyer wins case in 5 seconds and gets a $2 tip."
๐Ÿƒโ€โ™‚๏ธ Dramatic Exit (ALWAYS USE [get_out])
"Left: Lawyer> I quit. [get_out]"
   Left Actor={left_speaker}
Right Actor={right_speaker}
Theme={theme}     
        """
    )
    if additional_details.strip():
        prompt += f"Additional Details: {additional_details}\n"

    

    # Prepare the message payload for the Groq API call.
    messages = [
        {
            "role": "user",
            "content": prompt,
        }
    ]
    
    # Model selection: adjust as needed.
    
    model = "llama3-70b-8192"

    try:
        # Make the chat completion call using Groq.
        chat_completion = client.chat.completions.create(
            messages=messages,
            model=model,
        )

        # Extract the generated conversation from the API response.
        result_text = chat_completion.choices[0].message.content

        if not result_text:
            st.error("The API call did not return any content.")
        else:
            st.success("Conversation generated successfully!")
            
            # Display the result inside a text area.
            st.write("### Generated Conversation Script")
            st.text_area("", result_text, height=300)
            
            # Create a downloadable TXT file.
            txt_bytes = result_text.encode("utf-8")
            txt_io = io.BytesIO(txt_bytes)
            st.download_button(
                label="Download Script as TXT",
                data=txt_io,
                file_name="conversation_script.txt",
                mime="text/plain"
            )

    except Exception as e:
        st.error(f"An error occurred while calling the API: {e}")