selfitcamera commited on
Commit ·
4651b95
1
Parent(s): 03ab57a
init
Browse files
app.py
CHANGED
|
@@ -9,9 +9,9 @@ from util import (
|
|
| 9 |
|
| 10 |
IP_Dict = {}
|
| 11 |
|
| 12 |
-
def
|
| 13 |
"""
|
| 14 |
-
|
| 15 |
"""
|
| 16 |
client_ip = request.client.host
|
| 17 |
x_forwarded_for = dict(request.headers).get('x-forwarded-for')
|
|
@@ -26,7 +26,7 @@ def generate_morgan_freeman_voice_with_realtime_updates(text, word_num, request:
|
|
| 26 |
# Create "Get More Tries" button HTML
|
| 27 |
get_more_tries_html = f"""
|
| 28 |
<div style='display: flex; justify-content: center; gap: 30px; margin: 10px 0 25px 0; padding: 0px;'>
|
| 29 |
-
<a href='https://trumpaivoice.net/
|
| 30 |
display: inline-flex;
|
| 31 |
align-items: center;
|
| 32 |
justify-content: center;
|
|
@@ -51,6 +51,33 @@ def generate_morgan_freeman_voice_with_realtime_updates(text, word_num, request:
|
|
| 51 |
if not text or len(text.strip()) < 3:
|
| 52 |
return "Text too short, please enter at least 3 characters", None, "No task information", gr.update(visible=False), ""
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
try:
|
| 55 |
task_type = "voice"
|
| 56 |
|
|
@@ -82,7 +109,7 @@ def generate_morgan_freeman_voice_with_realtime_updates(text, word_num, request:
|
|
| 82 |
# Create action buttons HTML
|
| 83 |
action_buttons_html = f"""
|
| 84 |
<div style='display: flex; justify-content: center; gap: 30px; margin: 25px 0; padding: 20px;'>
|
| 85 |
-
<a href='https://trumpaivoice.net/
|
| 86 |
display: inline-flex;
|
| 87 |
align-items: center;
|
| 88 |
justify-content: center;
|
|
@@ -132,13 +159,13 @@ def generate_morgan_freeman_voice_with_realtime_updates(text, word_num, request:
|
|
| 132 |
return error_msg, None, f"❌ Error message: {error_msg}", gr.update(visible=False), ""
|
| 133 |
|
| 134 |
# Create Gradio Interface
|
| 135 |
-
with gr.Blocks(title="
|
| 136 |
|
| 137 |
# Main title - at the top
|
| 138 |
gr.HTML("""
|
| 139 |
<div style="text-align: center; margin: 5px auto 0px auto; max-width: 800px;">
|
| 140 |
<h1 style="color: #2c3e50; margin: 0; font-size: 3.5em; font-weight: 800; letter-spacing: 3px; text-shadow: 2px 2px 4px rgba(0,0,0,0.1);">
|
| 141 |
-
|
| 142 |
</h1>
|
| 143 |
</div>
|
| 144 |
""", padding=False)
|
|
@@ -157,8 +184,9 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 157 |
text_input = gr.Textbox(
|
| 158 |
label="📝 Input Text",
|
| 159 |
lines=4,
|
| 160 |
-
|
| 161 |
-
|
|
|
|
| 162 |
)
|
| 163 |
|
| 164 |
with gr.Column(scale=1):
|
|
@@ -168,7 +196,7 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 168 |
)
|
| 169 |
|
| 170 |
submit_btn = gr.Button(
|
| 171 |
-
"
|
| 172 |
variant="primary",
|
| 173 |
size="lg"
|
| 174 |
)
|
|
@@ -186,7 +214,7 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 186 |
|
| 187 |
with gr.Row():
|
| 188 |
audio_output = gr.Audio(
|
| 189 |
-
label="🎵
|
| 190 |
interactive=False
|
| 191 |
)
|
| 192 |
|
|
@@ -206,15 +234,15 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 206 |
<!-- Hero Description -->
|
| 207 |
<div style="text-align: center; margin: 25px auto; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); padding: 30px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);">
|
| 208 |
<h2 style="color: #2c3e50; margin: 0 0 15px 0; font-size: 1.8em; font-weight: 700;">
|
| 209 |
-
|
| 210 |
</h2>
|
| 211 |
<p style="color: #555; font-size: 1.1em; line-height: 1.6; margin: 0 0 20px 0; width: 100%; padding: 0 20px;">
|
| 212 |
-
Transform any text into the iconic
|
| 213 |
-
Whether you're creating
|
| 214 |
-
captures
|
| 215 |
</p>
|
| 216 |
<div style="text-align: center; margin: 15px 0;">
|
| 217 |
-
<a href="https://trumpaivoice.net/
|
| 218 |
display: inline-flex;
|
| 219 |
align-items: center;
|
| 220 |
justify-content: center;
|
|
@@ -227,7 +255,7 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 227 |
font-size: 14px;
|
| 228 |
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
|
| 229 |
transition: all 0.3s ease;
|
| 230 |
-
">🎬 Generate
|
| 231 |
</div>
|
| 232 |
</div>
|
| 233 |
|
|
@@ -236,11 +264,11 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 236 |
|
| 237 |
<div style="background: white; padding: 25px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #e74c3c;">
|
| 238 |
<h3 style="color: #e74c3c; margin: 0 0 12px 0; font-size: 1.3em; font-weight: 600;">
|
| 239 |
-
🎯
|
| 240 |
</h3>
|
| 241 |
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 242 |
-
Our AI model captures
|
| 243 |
-
trained on
|
| 244 |
</p>
|
| 245 |
</div>
|
| 246 |
|
|
@@ -249,18 +277,18 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 249 |
⚡ Lightning Fast Generation
|
| 250 |
</h3>
|
| 251 |
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 252 |
-
Generate high-quality
|
| 253 |
-
ensures rapid processing while maintaining
|
| 254 |
</p>
|
| 255 |
</div>
|
| 256 |
|
| 257 |
<div style="background: white; padding: 25px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #27ae60;">
|
| 258 |
<h3 style="color: #27ae60; margin: 0 0 12px 0; font-size: 1.3em; font-weight: 600;">
|
| 259 |
-
🎨 Perfect for
|
| 260 |
</h3>
|
| 261 |
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 262 |
-
Ideal for
|
| 263 |
-
or any project that needs that unmistakable
|
| 264 |
</p>
|
| 265 |
</div>
|
| 266 |
|
|
@@ -323,18 +351,18 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 323 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px;">
|
| 324 |
|
| 325 |
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 326 |
-
<strong style="color: #8b5cf6;">📖
|
| 327 |
-
<span style="color: #555;"> Use
|
| 328 |
</div>
|
| 329 |
|
| 330 |
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 331 |
<strong style="color: #8b5cf6;">⏱️ Length Matters:</strong>
|
| 332 |
-
<span style="color: #555;"> Shorter texts (20-60 words) typically produce the most natural-sounding
|
| 333 |
</div>
|
| 334 |
|
| 335 |
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 336 |
-
<strong style="color: #8b5cf6;">
|
| 337 |
-
<span style="color: #555;"> Text
|
| 338 |
</div>
|
| 339 |
|
| 340 |
</div>
|
|
@@ -348,7 +376,7 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 348 |
gr.HTML("""
|
| 349 |
<div style="text-align: center; margin: 0px auto -5px auto;">
|
| 350 |
<p style="margin: 0; font-size: 16px; color: #999; font-weight: 400;">
|
| 351 |
-
Click <a href="https://trumpaivoice.net/showcase" target="_blank" style="color: #667eea; text-decoration: none;">
|
| 352 |
</p>
|
| 353 |
</div>
|
| 354 |
""", padding=False)
|
|
@@ -358,7 +386,7 @@ with gr.Blocks(title="Morgan Freeman AI Voice", theme=gr.themes.Soft()) as demo:
|
|
| 358 |
|
| 359 |
# Bind event
|
| 360 |
submit_btn.click(
|
| 361 |
-
|
| 362 |
inputs=[text_input, word_num_slider],
|
| 363 |
outputs=[status_output, audio_output, task_info, action_links, task_url_state]
|
| 364 |
)
|
|
|
|
| 9 |
|
| 10 |
IP_Dict = {}
|
| 11 |
|
| 12 |
+
def generate_snoop_dogg_voice_with_realtime_updates(text, word_num, request: gr.Request):
|
| 13 |
"""
|
| 14 |
+
Snoop Dogg AI voice generation function with real-time status updates
|
| 15 |
"""
|
| 16 |
client_ip = request.client.host
|
| 17 |
x_forwarded_for = dict(request.headers).get('x-forwarded-for')
|
|
|
|
| 26 |
# Create "Get More Tries" button HTML
|
| 27 |
get_more_tries_html = f"""
|
| 28 |
<div style='display: flex; justify-content: center; gap: 30px; margin: 10px 0 25px 0; padding: 0px;'>
|
| 29 |
+
<a href='https://trumpaivoice.net/snoop-dogg-ai-voice#generator' target='_blank' style='
|
| 30 |
display: inline-flex;
|
| 31 |
align-items: center;
|
| 32 |
justify-content: center;
|
|
|
|
| 51 |
if not text or len(text.strip()) < 3:
|
| 52 |
return "Text too short, please enter at least 3 characters", None, "No task information", gr.update(visible=False), ""
|
| 53 |
|
| 54 |
+
if len(text.strip()) >= 1800:
|
| 55 |
+
msg = "⚠️ This space has a maximum limit of 2000 characters. Please visit our official website to generate longer content for free."
|
| 56 |
+
# Create "Go to Official Website" button HTML
|
| 57 |
+
go_to_website_html = f"""
|
| 58 |
+
<div style='display: flex; justify-content: center; gap: 30px; margin: 10px 0 25px 0; padding: 0px;'>
|
| 59 |
+
<a href='https://trumpaivoice.net/snoop-dogg-ai-voice#generator' target='_blank' style='
|
| 60 |
+
display: inline-flex;
|
| 61 |
+
align-items: center;
|
| 62 |
+
justify-content: center;
|
| 63 |
+
padding: 16px 32px;
|
| 64 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 65 |
+
color: white;
|
| 66 |
+
text-decoration: none;
|
| 67 |
+
border-radius: 12px;
|
| 68 |
+
font-weight: 600;
|
| 69 |
+
font-size: 16px;
|
| 70 |
+
text-align: center;
|
| 71 |
+
min-width: 160px;
|
| 72 |
+
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
|
| 73 |
+
transition: all 0.3s ease;
|
| 74 |
+
border: none;
|
| 75 |
+
'>🌐 Go to Official Website for Free</a>
|
| 76 |
+
</div>
|
| 77 |
+
"""
|
| 78 |
+
yield msg, None, "", gr.update(value=go_to_website_html, visible=True), ""
|
| 79 |
+
return msg, None, "", gr.update(value=go_to_website_html, visible=True), ""
|
| 80 |
+
|
| 81 |
try:
|
| 82 |
task_type = "voice"
|
| 83 |
|
|
|
|
| 109 |
# Create action buttons HTML
|
| 110 |
action_buttons_html = f"""
|
| 111 |
<div style='display: flex; justify-content: center; gap: 30px; margin: 25px 0; padding: 20px;'>
|
| 112 |
+
<a href='https://trumpaivoice.net/snoop-dogg-ai-voice#generator' target='_blank' style='
|
| 113 |
display: inline-flex;
|
| 114 |
align-items: center;
|
| 115 |
justify-content: center;
|
|
|
|
| 159 |
return error_msg, None, f"❌ Error message: {error_msg}", gr.update(visible=False), ""
|
| 160 |
|
| 161 |
# Create Gradio Interface
|
| 162 |
+
with gr.Blocks(title="Snoop Dogg AI Voice", theme=gr.themes.Soft()) as demo:
|
| 163 |
|
| 164 |
# Main title - at the top
|
| 165 |
gr.HTML("""
|
| 166 |
<div style="text-align: center; margin: 5px auto 0px auto; max-width: 800px;">
|
| 167 |
<h1 style="color: #2c3e50; margin: 0; font-size: 3.5em; font-weight: 800; letter-spacing: 3px; text-shadow: 2px 2px 4px rgba(0,0,0,0.1);">
|
| 168 |
+
🎤 Snoop Dogg AI Voice
|
| 169 |
</h1>
|
| 170 |
</div>
|
| 171 |
""", padding=False)
|
|
|
|
| 184 |
text_input = gr.Textbox(
|
| 185 |
label="📝 Input Text",
|
| 186 |
lines=4,
|
| 187 |
+
max_length=2000,
|
| 188 |
+
placeholder="Enter what you want Snoop Dogg to say...",
|
| 189 |
+
value="Yo, what's up everybody? This is your boy demonstrating this smooth Snoop Dogg AI voice system. We keepin' it real with that laid back West Coast vibe, you dig?"
|
| 190 |
)
|
| 191 |
|
| 192 |
with gr.Column(scale=1):
|
|
|
|
| 196 |
)
|
| 197 |
|
| 198 |
submit_btn = gr.Button(
|
| 199 |
+
"🎤 Generate Snoop Dogg AI Voice",
|
| 200 |
variant="primary",
|
| 201 |
size="lg"
|
| 202 |
)
|
|
|
|
| 214 |
|
| 215 |
with gr.Row():
|
| 216 |
audio_output = gr.Audio(
|
| 217 |
+
label="🎵 Snoop Dogg AI Voice",
|
| 218 |
interactive=False
|
| 219 |
)
|
| 220 |
|
|
|
|
| 234 |
<!-- Hero Description -->
|
| 235 |
<div style="text-align: center; margin: 25px auto; background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%); padding: 30px; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1);">
|
| 236 |
<h2 style="color: #2c3e50; margin: 0 0 15px 0; font-size: 1.8em; font-weight: 700;">
|
| 237 |
+
🎤 Experience the Legendary Voice of Snoop Dogg
|
| 238 |
</h2>
|
| 239 |
<p style="color: #555; font-size: 1.1em; line-height: 1.6; margin: 0 0 20px 0; width: 100%; padding: 0 20px;">
|
| 240 |
+
Transform any text into the iconic voice of Snoop Dogg with our cutting-edge AI voice synthesis technology.
|
| 241 |
+
Whether you're creating hip-hop content, entertainment videos, or adding that smooth West Coast flavor to your projects,
|
| 242 |
+
our advanced neural network captures Snoop's distinctive laid-back delivery, unique rhythm, and legendary rap style with incredible accuracy.
|
| 243 |
</p>
|
| 244 |
<div style="text-align: center; margin: 15px 0;">
|
| 245 |
+
<a href="https://trumpaivoice.net/snoop-dogg-ai-voice#generator" target="_blank" style="
|
| 246 |
display: inline-flex;
|
| 247 |
align-items: center;
|
| 248 |
justify-content: center;
|
|
|
|
| 255 |
font-size: 14px;
|
| 256 |
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
|
| 257 |
transition: all 0.3s ease;
|
| 258 |
+
">🎬 Generate Snoop Dogg AI Videos & More →</a>
|
| 259 |
</div>
|
| 260 |
</div>
|
| 261 |
|
|
|
|
| 264 |
|
| 265 |
<div style="background: white; padding: 25px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #e74c3c;">
|
| 266 |
<h3 style="color: #e74c3c; margin: 0 0 12px 0; font-size: 1.3em; font-weight: 600;">
|
| 267 |
+
🎯 Authentic West Coast Flow
|
| 268 |
</h3>
|
| 269 |
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 270 |
+
Our AI model captures Snoop Dogg's signature laid-back delivery, smooth flow, and distinctive pronunciation,
|
| 271 |
+
trained on decades of his music, interviews, and iconic performances to deliver that authentic Doggfather vibe.
|
| 272 |
</p>
|
| 273 |
</div>
|
| 274 |
|
|
|
|
| 277 |
⚡ Lightning Fast Generation
|
| 278 |
</h3>
|
| 279 |
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 280 |
+
Generate high-quality Snoop Dogg AI voice clips in seconds, not minutes. Our optimized infrastructure
|
| 281 |
+
ensures rapid processing while maintaining that smooth, distinctive vocal quality that made Snoop legendary.
|
| 282 |
</p>
|
| 283 |
</div>
|
| 284 |
|
| 285 |
<div style="background: white; padding: 25px; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.08); border-left: 5px solid #27ae60;">
|
| 286 |
<h3 style="color: #27ae60; margin: 0 0 12px 0; font-size: 1.3em; font-weight: 600;">
|
| 287 |
+
🎨 Perfect for Hip-Hop Content
|
| 288 |
</h3>
|
| 289 |
<p style="color: #666; margin: 0; line-height: 1.5; font-size: 0.95em;">
|
| 290 |
+
Ideal for rap music, comedy sketches, gaming content, memes, social media videos,
|
| 291 |
+
or any creative project that needs that unmistakable Snoop Dogg swagger and charisma.
|
| 292 |
</p>
|
| 293 |
</div>
|
| 294 |
|
|
|
|
| 351 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px;">
|
| 352 |
|
| 353 |
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 354 |
+
<strong style="color: #8b5cf6;">📖 Keep it Real:</strong>
|
| 355 |
+
<span style="color: #555;"> Use casual, conversational language for that authentic Snoop Dogg vibe.</span>
|
| 356 |
</div>
|
| 357 |
|
| 358 |
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 359 |
<strong style="color: #8b5cf6;">⏱️ Length Matters:</strong>
|
| 360 |
+
<span style="color: #555;"> Shorter texts (20-60 words) typically produce the smoothest, most natural-sounding results.</span>
|
| 361 |
</div>
|
| 362 |
|
| 363 |
<div style="background: rgba(255,255,255,0.8); padding: 15px; border-radius: 10px;">
|
| 364 |
+
<strong style="color: #8b5cf6;">🎤 Hip-Hop Style:</strong>
|
| 365 |
+
<span style="color: #555;"> Text with rap rhythm, slang, and West Coast flavor will sound more authentic and cool.</span>
|
| 366 |
</div>
|
| 367 |
|
| 368 |
</div>
|
|
|
|
| 376 |
gr.HTML("""
|
| 377 |
<div style="text-align: center; margin: 0px auto -5px auto;">
|
| 378 |
<p style="margin: 0; font-size: 16px; color: #999; font-weight: 400;">
|
| 379 |
+
Click <a href="https://trumpaivoice.net/showcase" target="_blank" style="color: #667eea; text-decoration: none;"> snoop dogg ai voices showcase </a> to see more videos
|
| 380 |
</p>
|
| 381 |
</div>
|
| 382 |
""", padding=False)
|
|
|
|
| 386 |
|
| 387 |
# Bind event
|
| 388 |
submit_btn.click(
|
| 389 |
+
generate_snoop_dogg_voice_with_realtime_updates,
|
| 390 |
inputs=[text_input, word_num_slider],
|
| 391 |
outputs=[status_output, audio_output, task_info, action_links, task_url_state]
|
| 392 |
)
|