LipKit commited on
Commit Β·
30ca3fe
1
Parent(s): e230d79
Deploy LipKit v1.0 - Free AI Lip Sync Studio
Browse files- __pycache__/app.cpython-314.pyc +0 -0
- app.py +31 -108
__pycache__/app.cpython-314.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-314.pyc and b/__pycache__/app.cpython-314.pyc differ
|
|
|
app.py
CHANGED
|
@@ -319,152 +319,75 @@ LANG_CHOICES = [f"{v['flag']} {k}" for k, v in LANGUAGES.items()]
|
|
| 319 |
LANG_MAP = {f"{v['flag']} {k}": k for k, v in LANGUAGES.items()}
|
| 320 |
|
| 321 |
CSS = """
|
| 322 |
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800
|
| 323 |
* { font-family: 'Inter', system-ui, sans-serif; }
|
| 324 |
-
body { background: #
|
| 325 |
-
.gradio-container { max-width:
|
| 326 |
footer { display: none !important; }
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
.gr-
|
| 330 |
-
|
| 331 |
-
/* Section Cards */
|
| 332 |
-
.section-card { background: rgba(16,16,24,0.7); border: 1px solid rgba(255,255,255,0.06); border-radius: 14px; padding: 20px; margin-bottom: 16px; }
|
| 333 |
-
.section-card h3 { font-size: 13px; font-weight: 700; color: #a1a1aa; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
|
| 334 |
-
.section-card h3 .step { display: inline-flex; width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #a855f7, #7c3aed); color: #fff; font-size: 11px; align-items: center; justify-content: center; }
|
| 335 |
-
|
| 336 |
-
/* Inputs */
|
| 337 |
-
input, textarea, select, .gr-input { background: rgba(22,22,34,0.9) !important; border: 1.5px solid rgba(255,255,255,0.06) !important; border-radius: 10px !important; color: #f4f4f5 !important; font-size: 14px !important; padding: 11px 15px !important; transition: all 0.2s ease !important; }
|
| 338 |
-
input:focus, textarea:focus { border-color: #a855f7 !important; box-shadow: 0 0 0 3px rgba(168,85,247,0.1) !important; outline: none !important; }
|
| 339 |
-
label, .gr-label { font-weight: 600 !important; font-size: 11px !important; text-transform: uppercase !important; letter-spacing: 0.08em !important; color: #71717a !important; margin-bottom: 6px !important; }
|
| 340 |
-
|
| 341 |
-
/* Buttons */
|
| 342 |
-
.gr-button-primary, button.gr-button.lg.primary { background: linear-gradient(135deg, #a855f7, #7c3aed) !important; border: none !important; border-radius: 10px !important; color: #fff !important; font-weight: 700 !important; font-size: 15px !important; padding: 12px 24px !important; box-shadow: 0 4px 20px rgba(168,85,247,0.25) !important; transition: all 0.2s ease !important; cursor: pointer !important; }
|
| 343 |
-
.gr-button-primary:hover { transform: translateY(-1px) !important; box-shadow: 0 6px 28px rgba(168,85,247,0.35) !important; }
|
| 344 |
-
button.gr-button:not(.primary):not(.lg) { background: rgba(255,255,255,0.03) !important; border: 1px solid rgba(255,255,255,0.06) !important; border-radius: 8px !important; color: #a1a1aa !important; font-weight: 500 !important; font-size: 13px !important; padding: 8px 16px !important; transition: all 0.15s ease !important; }
|
| 345 |
-
button.gr-button:not(.primary):not(.lg):hover { background: rgba(255,255,255,0.06) !important; color: #f4f4f5 !important; }
|
| 346 |
-
|
| 347 |
-
/* Tabs inside content */
|
| 348 |
-
.tabs { border: none !important; background: transparent !important; }
|
| 349 |
-
.tab-nav { gap: 4px !important; background: rgba(16,16,24,0.5) !important; border-radius: 10px !important; padding: 3px !important; border: 1px solid rgba(255,255,255,0.05) !important; display: flex !important; }
|
| 350 |
-
button.tab-nav { background: transparent !important; border-radius: 8px !important; padding: 8px 16px !important; font-weight: 600 !important; font-size: 13px !important; color: #71717a !important; transition: all 0.15s ease !important; border: none !important; flex: 1 !important; justify-content: center !important; }
|
| 351 |
-
button.tab-nav:hover { color: #f4f4f5 !important; background: rgba(255,255,255,0.03) !important; }
|
| 352 |
-
button.tab-nav.selected { background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(6,182,212,0.06)) !important; color: #a855f7 !important; }
|
| 353 |
-
|
| 354 |
-
/* Dropdown */
|
| 355 |
-
select { cursor: pointer !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2371717a' d='M5 7L1 3h8z'/%3E%3C/svg%3E") !important; background-repeat: no-repeat !important; background-position: right 12px center !important; padding-right: 32px !important; appearance: none !important; }
|
| 356 |
-
|
| 357 |
-
/* Gallery Grid */
|
| 358 |
-
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
|
| 359 |
-
.gallery-card { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 10px; overflow: hidden; transition: all 0.2s; }
|
| 360 |
-
.gallery-card:hover { border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.03); }
|
| 361 |
-
.gallery-card img, .gallery-card video { width: 100%; height: 170px; object-fit: cover; display: block; }
|
| 362 |
-
.gallery-card-body { padding: 12px; }
|
| 363 |
-
.gallery-card-footer { display: flex; justify-content: space-between; align-items: center; }
|
| 364 |
-
|
| 365 |
-
/* Misc */
|
| 366 |
-
.gr-checkbox { accent-color: #a855f7 !important; }
|
| 367 |
-
.gr-progress { background: rgba(255,255,255,0.04) !important; border-radius: 6px !important; height: 6px !important; }
|
| 368 |
-
.gr-progress > div { background: linear-gradient(90deg, #a855f7, #06b6d4) !important; border-radius: 6px !important; }
|
| 369 |
-
.gr-box img, .gr-box video { border-radius: 10px !important; }
|
| 370 |
-
.gr-markdown { color: #d4d4d8 !important; line-height: 1.6 !important; }
|
| 371 |
-
.gr-markdown h3 { font-size: 13px !important; font-weight: 700 !important; color: #e4e4e7 !important; text-transform: uppercase !important; letter-spacing: 0.06em !important; }
|
| 372 |
-
.gr-markdown p { color: #a1a1aa !important; }
|
| 373 |
-
::-webkit-scrollbar { width: 5px; }
|
| 374 |
-
::-webkit-scrollbar-track { background: #0a0a10; }
|
| 375 |
-
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
|
| 376 |
"""
|
| 377 |
|
| 378 |
-
# ββ Gradio UI ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 379 |
-
STATUS_MSG = "Models ready. All systems operational." if SETUP_OK else f"Setup error: {SETUP_ERR}"
|
| 380 |
-
|
| 381 |
# ββ Gradio UI ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 382 |
STATUS_MSG = "All systems operational" if SETUP_OK else f"Setup error: {SETUP_ERR}"
|
| 383 |
|
| 384 |
with gr.Blocks(title="VoiceKit Studio", css=CSS, theme=gr.themes.Soft(primary_hue="purple", secondary_hue="cyan", neutral_hue="slate")) as demo:
|
| 385 |
-
#
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
<div style="display:flex;justify-content:center;gap:8px;margin-top:10px;flex-wrap:wrap">
|
| 391 |
-
<span style="font-size:11px;padding:3px 10px;border-radius:12px;background:rgba(168,85,247,0.1);color:#a855f7;font-weight:600">{'π’ ' + STATUS_MSG if SETUP_OK else 'π΄ ' + STATUS_MSG}</span>
|
| 392 |
-
<span style="font-size:11px;padding:3px 10px;border-radius:12px;background:rgba(6,182,212,0.1);color:#06b6d4;font-weight:600">π {len(LANGUAGES)} Languages</span>
|
| 393 |
-
</div>
|
| 394 |
-
</div>
|
| 395 |
-
""")
|
| 396 |
-
|
| 397 |
-
with gr.Tabs(selected=0):
|
| 398 |
-
# βββββββββββββββ V2 AI AVATAR βββββββββββββββ
|
| 399 |
-
with gr.TabItem("ποΈ V2 AI Avatar"):
|
| 400 |
-
with gr.Row(equal_height=False):
|
| 401 |
with gr.Column(scale=3):
|
| 402 |
-
gr.
|
| 403 |
video_input = gr.Video(label="Face Video (MP4/MKV)", sources=["upload"])
|
| 404 |
-
gr.HTML("</div>")
|
| 405 |
|
| 406 |
-
gr.
|
| 407 |
-
|
| 408 |
-
voice_input = gr.Audio(label="Voice Sample (optional)", sources=["upload"], type="filepath")
|
| 409 |
with gr.Row():
|
| 410 |
-
lang_dropdown = gr.Dropdown(choices=LANG_CHOICES, value="πΊπΈ English (US)", label="
|
| 411 |
use_clone = gr.Checkbox(label="Clone my voice", value=True)
|
| 412 |
-
gr.HTML("</div>")
|
| 413 |
|
| 414 |
-
gr.
|
| 415 |
-
script_input = gr.Textbox(label="Script", placeholder="
|
| 416 |
generate_btn = gr.Button("π¬ Generate Lip-Synced Video", variant="primary", size="lg")
|
| 417 |
-
gr.HTML("</div>")
|
| 418 |
|
| 419 |
with gr.Column(scale=2):
|
| 420 |
-
gr.
|
| 421 |
video_output = gr.Video(label="Your Lip-Synced Video")
|
| 422 |
status_text = gr.Textbox(label="Status", interactive=False)
|
| 423 |
-
gr.HTML("</div>")
|
| 424 |
|
| 425 |
lang_state = gr.State("English (US)")
|
| 426 |
lang_dropdown.change(lambda v: LANG_MAP.get(v, "English (US)") if v else "English (US)", inputs=lang_dropdown, outputs=lang_state)
|
| 427 |
generate_btn.click(fn=lipkit_generate, inputs=[video_input, voice_input, script_input, use_clone, lang_state], outputs=[video_output, status_text])
|
| 428 |
|
| 429 |
-
gr.
|
| 430 |
-
gr.Examples(examples=[
|
| 431 |
-
[None, None, "Hey, I've been watching your content β the engagement is impressive. I built an AI tool that could turn one video into 50 personalized ones."],
|
| 432 |
-
[None, None, "What's up! I help founders turn one video into a hundred personalized clips using AI. No editing needed."],
|
| 433 |
-
], inputs=[video_input, voice_input, script_input], label="Click to try")
|
| 434 |
-
gr.HTML("</div>")
|
| 435 |
-
|
| 436 |
-
# History inside V2 tab
|
| 437 |
-
gr.HTML("""<div style="background:rgba(16,16,24,0.7);border:1px solid rgba(255,255,255,0.06);border-radius:14px;padding:20px;margin-bottom:16px"><h3 style="font-size:12px;font-weight:700;color:#a1a1aa;text-transform:uppercase;letter-spacing:0.08em;margin:0 0 14px">π Previously Generated Videos</h3>""")
|
| 438 |
v2_history_html = gr.HTML(value=refresh_v2_history())
|
| 439 |
-
gr.Button("π Refresh"
|
| 440 |
-
gr.HTML("</div>")
|
| 441 |
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
gr.HTML("""<div style="background:rgba(16,16,24,0.7);border:1px solid rgba(255,255,255,0.06);border-radius:14px;padding:20px;margin-bottom:16px"><h3 style="font-size:12px;font-weight:700;color:#a1a1aa;text-transform:uppercase;letter-spacing:0.08em;margin:0 0 14px"><span style="display:inline-flex;width:22px;height:22px;border-radius:6px;background:linear-gradient(135deg,#a855f7,#7c3aed);color:#fff;font-size:11px;align-items:center;justify-content:center;margin-right:8px">1</span> Upload Images</h3>""")
|
| 445 |
with gr.Row():
|
| 446 |
-
with gr.Column():
|
| 447 |
-
|
|
|
|
|
|
|
|
|
|
| 448 |
with gr.Row():
|
| 449 |
-
ivm_blur = gr.Checkbox(label="
|
| 450 |
-
ivm_video = gr.Checkbox(label="
|
| 451 |
-
gr.HTML("</div>")
|
| 452 |
|
| 453 |
ivm_btn = gr.Button("π§ Generate IVM", variant="primary", size="lg")
|
| 454 |
|
| 455 |
-
gr.HTML("""<div style="background:rgba(16,16,24,0.7);border:1px solid rgba(255,255,255,0.06);border-radius:14px;padding:20px;margin-bottom:16px"><h3 style="font-size:12px;font-weight:700;color:#a1a1aa;text-transform:uppercase;letter-spacing:0.08em;margin:0 0 14px">π¬ Result</h3>""")
|
| 456 |
with gr.Row():
|
| 457 |
ivm_img_out = gr.Image(label="Dress on Model", type="filepath")
|
| 458 |
ivm_vid_out = gr.Video(label="Looping Video")
|
| 459 |
-
gr.HTML("</div>")
|
| 460 |
|
| 461 |
ivm_btn.click(fn=ivm_generate, inputs=[ivm_dress, ivm_model, ivm_blur, ivm_video], outputs=[ivm_img_out, ivm_vid_out])
|
| 462 |
|
| 463 |
-
#
|
| 464 |
-
gr.HTML("""<div style="background:rgba(16,16,24,0.7);border:1px solid rgba(255,255,255,0.06);border-radius:14px;padding:20px;margin-bottom:16px"><h3 style="font-size:12px;font-weight:700;color:#a1a1aa;text-transform:uppercase;letter-spacing:0.08em;margin:0 0 14px">π Previously Generated Images</h3>""")
|
| 465 |
ivm_history_html = gr.HTML(value=refresh_ivm_history())
|
| 466 |
-
gr.Button("π Refresh"
|
| 467 |
-
gr.HTML("</div>")
|
| 468 |
|
| 469 |
|
| 470 |
if __name__ == "__main__":
|
|
|
|
| 319 |
LANG_MAP = {f"{v['flag']} {k}": k for k, v in LANGUAGES.items()}
|
| 320 |
|
| 321 |
CSS = """
|
| 322 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
|
| 323 |
* { font-family: 'Inter', system-ui, sans-serif; }
|
| 324 |
+
body { background: #0a0a0f !important; }
|
| 325 |
+
.gradio-container { max-width: 1100px !important; margin: auto; background: transparent !important; }
|
| 326 |
footer { display: none !important; }
|
| 327 |
+
.gr-box, .gr-form { border-radius: 14px !important; border: 1px solid rgba(255,255,255,0.06) !important; background: rgba(17,17,24,0.9) !important; }
|
| 328 |
+
input, textarea, select { background: rgba(22,22,31,0.9) !important; border: 1px solid rgba(255,255,255,0.08) !important; border-radius: 10px !important; color: #f1f1f5 !important; }
|
| 329 |
+
.gr-button-primary { background: linear-gradient(135deg, #a855f7, #7c3aed) !important; border: none !important; border-radius: 10px !important; color: #fff !important; font-weight: 600 !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
"""
|
| 331 |
|
|
|
|
|
|
|
|
|
|
| 332 |
# ββ Gradio UI ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 333 |
STATUS_MSG = "All systems operational" if SETUP_OK else f"Setup error: {SETUP_ERR}"
|
| 334 |
|
| 335 |
with gr.Blocks(title="VoiceKit Studio", css=CSS, theme=gr.themes.Soft(primary_hue="purple", secondary_hue="cyan", neutral_hue="slate")) as demo:
|
| 336 |
+
gr.Markdown(f"# ποΈ VoiceKit Studio\nAI Lip Sync Β· Neural Multi-Language TTS Β· IVM Dress-on-Model\n{STATUS_MSG} Β· π {len(LANGUAGES)} Languages")
|
| 337 |
+
|
| 338 |
+
with gr.Tabs():
|
| 339 |
+
with gr.TabItem("V2 AI Avatar"):
|
| 340 |
+
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 341 |
with gr.Column(scale=3):
|
| 342 |
+
gr.Markdown("### Step 1: Upload Face Video")
|
| 343 |
video_input = gr.Video(label="Face Video (MP4/MKV)", sources=["upload"])
|
|
|
|
| 344 |
|
| 345 |
+
gr.Markdown("### Step 2: Voice & Language")
|
| 346 |
+
voice_input = gr.Audio(label="Voice Sample (optional)", sources=["upload"], type="filepath")
|
|
|
|
| 347 |
with gr.Row():
|
| 348 |
+
lang_dropdown = gr.Dropdown(choices=LANG_CHOICES, value="πΊπΈ English (US)", label="Language", interactive=True)
|
| 349 |
use_clone = gr.Checkbox(label="Clone my voice", value=True)
|
|
|
|
| 350 |
|
| 351 |
+
gr.Markdown("### Step 3: Write Script")
|
| 352 |
+
script_input = gr.Textbox(label="Script", placeholder="Type your script here...", lines=4, max_lines=12)
|
| 353 |
generate_btn = gr.Button("π¬ Generate Lip-Synced Video", variant="primary", size="lg")
|
|
|
|
| 354 |
|
| 355 |
with gr.Column(scale=2):
|
| 356 |
+
gr.Markdown("### Output")
|
| 357 |
video_output = gr.Video(label="Your Lip-Synced Video")
|
| 358 |
status_text = gr.Textbox(label="Status", interactive=False)
|
|
|
|
| 359 |
|
| 360 |
lang_state = gr.State("English (US)")
|
| 361 |
lang_dropdown.change(lambda v: LANG_MAP.get(v, "English (US)") if v else "English (US)", inputs=lang_dropdown, outputs=lang_state)
|
| 362 |
generate_btn.click(fn=lipkit_generate, inputs=[video_input, voice_input, script_input, use_clone, lang_state], outputs=[video_output, status_text])
|
| 363 |
|
| 364 |
+
gr.Markdown("### Previously Generated Videos")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 365 |
v2_history_html = gr.HTML(value=refresh_v2_history())
|
| 366 |
+
gr.Button("π Refresh").click(fn=refresh_v2_history, outputs=v2_history_html)
|
|
|
|
| 367 |
|
| 368 |
+
with gr.TabItem("IVM Dress-on-Model"):
|
| 369 |
+
gr.Markdown("### Upload Images")
|
|
|
|
| 370 |
with gr.Row():
|
| 371 |
+
with gr.Column():
|
| 372 |
+
ivm_dress = gr.Image(label="Dress Photo", type="filepath", sources=["upload"])
|
| 373 |
+
with gr.Column():
|
| 374 |
+
ivm_model = gr.Image(label="Model Photo (optional)", type="filepath", sources=["upload"])
|
| 375 |
+
|
| 376 |
with gr.Row():
|
| 377 |
+
ivm_blur = gr.Checkbox(label="Blur face", value=True)
|
| 378 |
+
ivm_video = gr.Checkbox(label="Generate looping video (+2 min)", value=False)
|
|
|
|
| 379 |
|
| 380 |
ivm_btn = gr.Button("π§ Generate IVM", variant="primary", size="lg")
|
| 381 |
|
|
|
|
| 382 |
with gr.Row():
|
| 383 |
ivm_img_out = gr.Image(label="Dress on Model", type="filepath")
|
| 384 |
ivm_vid_out = gr.Video(label="Looping Video")
|
|
|
|
| 385 |
|
| 386 |
ivm_btn.click(fn=ivm_generate, inputs=[ivm_dress, ivm_model, ivm_blur, ivm_video], outputs=[ivm_img_out, ivm_vid_out])
|
| 387 |
|
| 388 |
+
gr.Markdown("### Previously Generated Images")
|
|
|
|
| 389 |
ivm_history_html = gr.HTML(value=refresh_ivm_history())
|
| 390 |
+
gr.Button("π Refresh").click(fn=refresh_ivm_history, outputs=ivm_history_html)
|
|
|
|
| 391 |
|
| 392 |
|
| 393 |
if __name__ == "__main__":
|