Spaces:
Running
Running
LipKit commited on
Commit Β·
dace5fb
1
Parent(s): bcc25d7
Deploy LipKit v1.0 - Free AI Lip Sync Studio
Browse files- __pycache__/app.cpython-314.pyc +0 -0
- app.py +176 -93
__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
|
@@ -320,139 +320,207 @@ LANG_MAP = {f"{v['flag']} {k}": k for k, v in LANGUAGES.items()}
|
|
| 320 |
CSS = """
|
| 321 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
|
| 322 |
* { font-family: 'Inter', system-ui, sans-serif; }
|
| 323 |
-
body { background: #
|
| 324 |
-
.gradio-container { max-width:
|
| 325 |
footer { display: none !important; }
|
| 326 |
|
| 327 |
-
/*
|
| 328 |
-
.app-
|
| 329 |
-
.app-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
.
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
.
|
| 337 |
-
.
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
.
|
| 346 |
-
.
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
.
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 356 |
.tabs { border: none !important; background: transparent !important; }
|
| 357 |
-
.tab-nav { gap: 4px !important; background: rgba(16,16,24,0.
|
| 358 |
-
button.tab-nav { background: transparent !important; border-radius:
|
| 359 |
-
button.tab-nav:hover { color: #
|
| 360 |
-
button.tab-nav.selected { background: linear-gradient(135deg, rgba(168,85,247,0.
|
| 361 |
-
|
| 362 |
-
/*
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
/*
|
| 366 |
-
.
|
| 367 |
-
.
|
| 368 |
-
.
|
| 369 |
-
|
| 370 |
-
|
|
|
|
|
|
|
|
|
|
| 371 |
.gr-checkbox { accent-color: #a855f7 !important; }
|
| 372 |
-
.gr-progress { background: rgba(255,255,255,0.
|
| 373 |
-
.gr-progress > div { background: linear-gradient(90deg, #a855f7, #06b6d4) !important; border-radius:
|
| 374 |
-
.gr-box img, .gr-box video { border-radius:
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
::-webkit-scrollbar
|
| 379 |
-
|
|
|
|
| 380 |
"""
|
| 381 |
|
| 382 |
# ββ Gradio UI ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
<
|
| 390 |
-
<
|
| 391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
</div>
|
| 393 |
</div>
|
|
|
|
| 394 |
"""
|
| 395 |
|
| 396 |
-
STATUS_MSG = "Models ready. All systems operational." if SETUP_OK else f"Setup error: {SETUP_ERR}"
|
| 397 |
-
|
| 398 |
with gr.Blocks(title="VoiceKit Studio", css=CSS, theme=gr.themes.Soft(primary_hue="purple", secondary_hue="cyan", neutral_hue="slate")) as demo:
|
| 399 |
-
gr.HTML(
|
| 400 |
|
| 401 |
with gr.Tabs(selected=0):
|
| 402 |
# βββββββββββββββ V2 AI AVATAR TAB βββββββββββββββ
|
| 403 |
-
with gr.TabItem("ποΈ V2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
with gr.Row(equal_height=False):
|
| 405 |
with gr.Column(scale=3):
|
| 406 |
-
|
|
|
|
| 407 |
video_input = gr.Video(label="Face Video (MP4/MKV)", sources=["upload"])
|
|
|
|
| 408 |
|
| 409 |
-
|
|
|
|
| 410 |
with gr.Row():
|
| 411 |
voice_input = gr.Audio(label="Voice Sample (optional)", sources=["upload"], type="filepath")
|
| 412 |
with gr.Row():
|
| 413 |
lang_dropdown = gr.Dropdown(choices=LANG_CHOICES, value="πΊπΈ English (US)", label="π Language", interactive=True)
|
| 414 |
use_clone = gr.Checkbox(label="Clone my voice", value=True)
|
|
|
|
| 415 |
|
| 416 |
-
|
|
|
|
| 417 |
script_input = gr.Textbox(
|
| 418 |
label="Script",
|
| 419 |
placeholder="Hey, I've been keeping an eye on your content and honestly β the engagement you're getting is impressive...",
|
| 420 |
-
lines=
|
| 421 |
)
|
| 422 |
-
|
| 423 |
generate_btn = gr.Button("π¬ Generate Lip-Synced Video", variant="primary", size="lg")
|
|
|
|
| 424 |
|
|
|
|
| 425 |
with gr.Column(scale=2):
|
| 426 |
-
gr.
|
| 427 |
video_output = gr.Video(label="Your Lip-Synced Video")
|
| 428 |
status_text = gr.Textbox(label="Status", interactive=False)
|
| 429 |
-
gr.
|
| 430 |
|
| 431 |
-
#
|
| 432 |
lang_state = gr.State("English (US)")
|
| 433 |
lang_dropdown.change(
|
| 434 |
lambda v: LANG_MAP.get(v, "English (US)") if v else "English (US)",
|
| 435 |
inputs=lang_dropdown, outputs=lang_state
|
| 436 |
)
|
| 437 |
-
|
| 438 |
generate_btn.click(fn=lipkit_generate,
|
| 439 |
inputs=[video_input, voice_input, script_input, use_clone, lang_state],
|
| 440 |
outputs=[video_output, status_text])
|
| 441 |
|
| 442 |
-
gr.
|
| 443 |
gr.Examples(examples=[
|
| 444 |
[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."],
|
| 445 |
[None, None, "What's up! I help founders turn one video into a hundred personalized clips using AI. No editing needed."],
|
| 446 |
], inputs=[video_input, voice_input, script_input], label="Click to try")
|
| 447 |
-
|
| 448 |
-
# ββ V2 History ββ
|
| 449 |
-
gr.Markdown("### π Previously Generated Videos")
|
| 450 |
-
v2_history_html = gr.HTML(value=refresh_v2_history())
|
| 451 |
-
gr.Button("π Refresh History", size="sm").click(fn=refresh_v2_history, outputs=v2_history_html)
|
| 452 |
|
| 453 |
# βββββββββββββββ IVM TAB βββββββββββββββ
|
| 454 |
-
with gr.TabItem("π§ IVM
|
| 455 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
with gr.Row():
|
| 457 |
with gr.Column():
|
| 458 |
ivm_dress = gr.Image(label="π Dress Photo *", type="filepath", sources=["upload"])
|
|
@@ -460,29 +528,44 @@ with gr.Blocks(title="VoiceKit Studio", css=CSS, theme=gr.themes.Soft(primary_hu
|
|
| 460 |
ivm_model = gr.Image(label="π§ Model Photo (optional)", type="filepath", sources=["upload"])
|
| 461 |
|
| 462 |
with gr.Row():
|
| 463 |
-
ivm_blur = gr.Checkbox(label="π΅ Blur face
|
| 464 |
-
ivm_video = gr.Checkbox(label="π¬
|
|
|
|
| 465 |
|
| 466 |
ivm_btn = gr.Button("π§ Generate IVM", variant="primary", size="lg")
|
| 467 |
|
|
|
|
| 468 |
with gr.Row():
|
| 469 |
-
ivm_img_out = gr.Image(label="
|
| 470 |
ivm_vid_out = gr.Video(label="Looping Video")
|
|
|
|
| 471 |
|
| 472 |
ivm_btn.click(fn=ivm_generate, inputs=[ivm_dress, ivm_model, ivm_blur, ivm_video],
|
| 473 |
outputs=[ivm_img_out, ivm_vid_out])
|
| 474 |
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
""")
|
| 481 |
|
| 482 |
-
|
| 483 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
ivm_history_html = gr.HTML(value=refresh_ivm_history())
|
| 485 |
gr.Button("π Refresh IVM History", size="sm").click(fn=refresh_ivm_history, outputs=ivm_history_html)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 486 |
|
| 487 |
|
| 488 |
if __name__ == "__main__":
|
|
|
|
| 320 |
CSS = """
|
| 321 |
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
|
| 322 |
* { font-family: 'Inter', system-ui, sans-serif; }
|
| 323 |
+
body { background: #0a0a10 !important; min-height: 100vh; margin: 0 !important; }
|
| 324 |
+
.gradio-container { max-width: 1400px !important; margin: 0 auto !important; background: transparent !important; padding: 0 !important; min-height: 100vh; }
|
| 325 |
footer { display: none !important; }
|
| 326 |
|
| 327 |
+
/* ===== APP LAYOUT ===== */
|
| 328 |
+
.app-wrapper { display: flex; min-height: 100vh; }
|
| 329 |
+
.app-sidebar { width: 240px; min-width: 240px; background: rgba(12,12,20,0.95); border-right: 1px solid rgba(255,255,255,0.06); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
|
| 330 |
+
.app-main { flex: 1; margin-left: 240px; padding: 32px; max-width: 1100px; }
|
| 331 |
+
|
| 332 |
+
/* Sidebar */
|
| 333 |
+
.sidebar-logo { padding: 24px 20px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); }
|
| 334 |
+
.sidebar-logo h1 { font-size: 20px; font-weight: 800; margin: 0; background: linear-gradient(135deg, #a855f7, #06b6d4); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -0.02em; }
|
| 335 |
+
.sidebar-logo p { font-size: 11px; color: #52525b; margin: 4px 0 0; font-weight: 500; }
|
| 336 |
+
.sidebar-nav { padding: 16px 12px; flex: 1; }
|
| 337 |
+
.sidebar-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: #52525b; padding: 8px 12px 6px; }
|
| 338 |
+
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; color: #a1a1aa; font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s ease; margin-bottom: 2px; border: none; background: transparent; width: 100%; text-align: left; }
|
| 339 |
+
.sidebar-item:hover { background: rgba(255,255,255,0.04); color: #e4e4e7; }
|
| 340 |
+
.sidebar-item.active { background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(6,182,212,0.06)); color: #a855f7; font-weight: 600; }
|
| 341 |
+
.sidebar-item .icon { font-size: 16px; width: 20px; text-align: center; }
|
| 342 |
+
.sidebar-item .badge { margin-left: auto; font-size: 9px; padding: 2px 6px; border-radius: 4px; background: rgba(168,85,247,0.15); color: #a855f7; font-weight: 700; }
|
| 343 |
+
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.06); }
|
| 344 |
+
.sidebar-status { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px; font-size: 11px; font-weight: 500; }
|
| 345 |
+
.sidebar-status.online { color: #22c55e; background: rgba(34,197,94,0.06); }
|
| 346 |
+
.sidebar-status .dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; display: inline-block; }
|
| 347 |
+
|
| 348 |
+
/* Top Bar */
|
| 349 |
+
.app-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
|
| 350 |
+
.topbar-left h2 { font-size: 22px; font-weight: 800; margin: 0; color: #f4f4f5; letter-spacing: -0.02em; }
|
| 351 |
+
.topbar-left p { font-size: 13px; color: #71717a; margin: 4px 0 0; }
|
| 352 |
+
.topbar-right { display: flex; gap: 10px; align-items: center; }
|
| 353 |
+
|
| 354 |
+
/* Main Cards */
|
| 355 |
+
.gr-box, .gr-form, .panel, .card, .gr-panel { border-radius: 14px !important; border: 1px solid rgba(255,255,255,0.06) !important; background: rgba(16,16,24,0.85) !important; box-shadow: 0 4px 24px rgba(0,0,0,0.3) !important; backdrop-filter: blur(16px) !important; padding: 20px !important; }
|
| 356 |
+
|
| 357 |
+
/* Section Cards */
|
| 358 |
+
.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; }
|
| 359 |
+
.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; }
|
| 360 |
+
.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; }
|
| 361 |
+
|
| 362 |
+
/* Inputs */
|
| 363 |
+
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; }
|
| 364 |
+
input:focus, textarea:focus { border-color: #a855f7 !important; box-shadow: 0 0 0 3px rgba(168,85,247,0.1) !important; outline: none !important; }
|
| 365 |
+
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; }
|
| 366 |
+
|
| 367 |
+
/* Buttons */
|
| 368 |
+
.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; }
|
| 369 |
+
.gr-button-primary:hover { transform: translateY(-1px) !important; box-shadow: 0 6px 28px rgba(168,85,247,0.35) !important; }
|
| 370 |
+
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; }
|
| 371 |
+
button.gr-button:not(.primary):not(.lg):hover { background: rgba(255,255,255,0.06) !important; color: #f4f4f5 !important; }
|
| 372 |
+
|
| 373 |
+
/* Tabs inside content */
|
| 374 |
.tabs { border: none !important; background: transparent !important; }
|
| 375 |
+
.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; }
|
| 376 |
+
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; }
|
| 377 |
+
button.tab-nav:hover { color: #f4f4f5 !important; background: rgba(255,255,255,0.03) !important; }
|
| 378 |
+
button.tab-nav.selected { background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(6,182,212,0.06)) !important; color: #a855f7 !important; }
|
| 379 |
+
|
| 380 |
+
/* Dropdown */
|
| 381 |
+
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; }
|
| 382 |
+
|
| 383 |
+
/* Gallery Grid */
|
| 384 |
+
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
|
| 385 |
+
.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; }
|
| 386 |
+
.gallery-card:hover { border-color: rgba(255,255,255,0.1); background: rgba(255,255,255,0.03); }
|
| 387 |
+
.gallery-card img, .gallery-card video { width: 100%; height: 170px; object-fit: cover; display: block; }
|
| 388 |
+
.gallery-card-body { padding: 12px; }
|
| 389 |
+
.gallery-card-footer { display: flex; justify-content: space-between; align-items: center; }
|
| 390 |
+
|
| 391 |
+
/* Misc */
|
| 392 |
.gr-checkbox { accent-color: #a855f7 !important; }
|
| 393 |
+
.gr-progress { background: rgba(255,255,255,0.04) !important; border-radius: 6px !important; height: 6px !important; }
|
| 394 |
+
.gr-progress > div { background: linear-gradient(90deg, #a855f7, #06b6d4) !important; border-radius: 6px !important; }
|
| 395 |
+
.gr-box img, .gr-box video { border-radius: 10px !important; }
|
| 396 |
+
.gr-markdown { color: #d4d4d8 !important; line-height: 1.6 !important; }
|
| 397 |
+
.gr-markdown h3 { font-size: 13px !important; font-weight: 700 !important; color: #e4e4e7 !important; text-transform: uppercase !important; letter-spacing: 0.06em !important; }
|
| 398 |
+
.gr-markdown p { color: #a1a1aa !important; }
|
| 399 |
+
::-webkit-scrollbar { width: 5px; }
|
| 400 |
+
::-webkit-scrollbar-track { background: #0a0a10; }
|
| 401 |
+
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
|
| 402 |
"""
|
| 403 |
|
| 404 |
# ββ Gradio UI ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 405 |
+
STATUS_MSG = "Models ready. All systems operational." if SETUP_OK else f"Setup error: {SETUP_ERR}"
|
| 406 |
+
|
| 407 |
+
SIDEBAR = f"""
|
| 408 |
+
<div class="app-wrapper">
|
| 409 |
+
<div class="app-sidebar">
|
| 410 |
+
<div class="sidebar-logo">
|
| 411 |
+
<h1>VoiceKit</h1>
|
| 412 |
+
<p>AI Studio</p>
|
| 413 |
+
</div>
|
| 414 |
+
<div class="sidebar-nav">
|
| 415 |
+
<div class="sidebar-label">Tools</div>
|
| 416 |
+
<button class="sidebar-item active" onclick="document.querySelectorAll('.tab-nav')[0]?.click()">
|
| 417 |
+
<span class="icon">ποΈ</span> V2 AI Avatar
|
| 418 |
+
</button>
|
| 419 |
+
<button class="sidebar-item" onclick="document.querySelectorAll('.tab-nav')[1]?.click()">
|
| 420 |
+
<span class="icon">π§ </span> IVM Studio
|
| 421 |
+
</button>
|
| 422 |
+
<div style="margin-top:20px">
|
| 423 |
+
<div class="sidebar-label">History</div>
|
| 424 |
+
<button class="sidebar-item" onclick="document.querySelectorAll('.tab-nav')[2]?.click()">
|
| 425 |
+
<span class="icon">π</span> Past Generations
|
| 426 |
+
<span class="badge">V2+IVM</span>
|
| 427 |
+
</button>
|
| 428 |
+
</div>
|
| 429 |
+
</div>
|
| 430 |
+
<div class="sidebar-footer">
|
| 431 |
+
<div class="sidebar-status online">
|
| 432 |
+
<span class="dot"></span>
|
| 433 |
+
{'All Systems Operational' if SETUP_OK else 'Setup Error'}
|
| 434 |
+
</div>
|
| 435 |
+
<div style="font-size:10px;color:#52525b;padding:8px 14px 0;margin-top:4px">
|
| 436 |
+
{len(LANGUAGES)} languages Β· Microsoft Neural TTS
|
| 437 |
+
</div>
|
| 438 |
</div>
|
| 439 |
</div>
|
| 440 |
+
<div class="app-main">
|
| 441 |
"""
|
| 442 |
|
|
|
|
|
|
|
| 443 |
with gr.Blocks(title="VoiceKit Studio", css=CSS, theme=gr.themes.Soft(primary_hue="purple", secondary_hue="cyan", neutral_hue="slate")) as demo:
|
| 444 |
+
gr.HTML(SIDEBAR)
|
| 445 |
|
| 446 |
with gr.Tabs(selected=0):
|
| 447 |
# βββββββββββββββ V2 AI AVATAR TAB βββββββββββββββ
|
| 448 |
+
with gr.TabItem("ποΈ V2"):
|
| 449 |
+
# Top bar
|
| 450 |
+
gr.HTML(f"""
|
| 451 |
+
<div class="app-topbar">
|
| 452 |
+
<div class="topbar-left">
|
| 453 |
+
<h2>V2 AI Avatar</h2>
|
| 454 |
+
<p>Generate lip-synced videos in any language with neural AI voice cloning</p>
|
| 455 |
+
</div>
|
| 456 |
+
<div class="topbar-right">
|
| 457 |
+
<span style="font-size:11px;padding:4px 12px;background:rgba(168,85,247,0.1);border-radius:6px;color:#a855f7;font-weight:600">π {len(LANGUAGES)} Languages</span>
|
| 458 |
+
</div>
|
| 459 |
+
</div>
|
| 460 |
+
""")
|
| 461 |
+
|
| 462 |
with gr.Row(equal_height=False):
|
| 463 |
with gr.Column(scale=3):
|
| 464 |
+
# Step 1
|
| 465 |
+
gr.HTML("""<div class="section-card"><h3><span class="step">1</span> Upload Face Video</h3>""")
|
| 466 |
video_input = gr.Video(label="Face Video (MP4/MKV)", sources=["upload"])
|
| 467 |
+
gr.HTML("</div>")
|
| 468 |
|
| 469 |
+
# Step 2
|
| 470 |
+
gr.HTML("""<div class="section-card"><h3><span class="step">2</span> Voice & Language</h3>""")
|
| 471 |
with gr.Row():
|
| 472 |
voice_input = gr.Audio(label="Voice Sample (optional)", sources=["upload"], type="filepath")
|
| 473 |
with gr.Row():
|
| 474 |
lang_dropdown = gr.Dropdown(choices=LANG_CHOICES, value="πΊπΈ English (US)", label="π Language", interactive=True)
|
| 475 |
use_clone = gr.Checkbox(label="Clone my voice", value=True)
|
| 476 |
+
gr.HTML("</div>")
|
| 477 |
|
| 478 |
+
# Step 3
|
| 479 |
+
gr.HTML("""<div class="section-card"><h3><span class="step">3</span> Write Your Script</h3>""")
|
| 480 |
script_input = gr.Textbox(
|
| 481 |
label="Script",
|
| 482 |
placeholder="Hey, I've been keeping an eye on your content and honestly β the engagement you're getting is impressive...",
|
| 483 |
+
lines=4, max_lines=12,
|
| 484 |
)
|
|
|
|
| 485 |
generate_btn = gr.Button("π¬ Generate Lip-Synced Video", variant="primary", size="lg")
|
| 486 |
+
gr.HTML("</div>")
|
| 487 |
|
| 488 |
+
# Output column
|
| 489 |
with gr.Column(scale=2):
|
| 490 |
+
gr.HTML("""<div class="section-card"><h3>π¬ Output</h3>""")
|
| 491 |
video_output = gr.Video(label="Your Lip-Synced Video")
|
| 492 |
status_text = gr.Textbox(label="Status", interactive=False)
|
| 493 |
+
gr.HTML("</div>")
|
| 494 |
|
| 495 |
+
# Language state
|
| 496 |
lang_state = gr.State("English (US)")
|
| 497 |
lang_dropdown.change(
|
| 498 |
lambda v: LANG_MAP.get(v, "English (US)") if v else "English (US)",
|
| 499 |
inputs=lang_dropdown, outputs=lang_state
|
| 500 |
)
|
|
|
|
| 501 |
generate_btn.click(fn=lipkit_generate,
|
| 502 |
inputs=[video_input, voice_input, script_input, use_clone, lang_state],
|
| 503 |
outputs=[video_output, status_text])
|
| 504 |
|
| 505 |
+
gr.HTML("""<div class="section-card"><h3>π‘ Script Examples</h3>""")
|
| 506 |
gr.Examples(examples=[
|
| 507 |
[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."],
|
| 508 |
[None, None, "What's up! I help founders turn one video into a hundred personalized clips using AI. No editing needed."],
|
| 509 |
], inputs=[video_input, voice_input, script_input], label="Click to try")
|
| 510 |
+
gr.HTML("</div>")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 511 |
|
| 512 |
# βββββββββββββββ IVM TAB βββββββββββββββ
|
| 513 |
+
with gr.TabItem("π§ IVM"):
|
| 514 |
+
gr.HTML("""
|
| 515 |
+
<div class="app-topbar">
|
| 516 |
+
<div class="topbar-left">
|
| 517 |
+
<h2>IVM Studio</h2>
|
| 518 |
+
<p>Image + Video + Model β AI dress-on-model generator</p>
|
| 519 |
+
</div>
|
| 520 |
+
</div>
|
| 521 |
+
""")
|
| 522 |
+
|
| 523 |
+
gr.HTML("""<div class="section-card"><h3><span class="step">1</span> Upload Images</h3>""")
|
| 524 |
with gr.Row():
|
| 525 |
with gr.Column():
|
| 526 |
ivm_dress = gr.Image(label="π Dress Photo *", type="filepath", sources=["upload"])
|
|
|
|
| 528 |
ivm_model = gr.Image(label="π§ Model Photo (optional)", type="filepath", sources=["upload"])
|
| 529 |
|
| 530 |
with gr.Row():
|
| 531 |
+
ivm_blur = gr.Checkbox(label="π΅ Blur face", value=True)
|
| 532 |
+
ivm_video = gr.Checkbox(label="π¬ Looping video", value=False)
|
| 533 |
+
gr.HTML("</div>")
|
| 534 |
|
| 535 |
ivm_btn = gr.Button("π§ Generate IVM", variant="primary", size="lg")
|
| 536 |
|
| 537 |
+
gr.HTML("""<div class="section-card"><h3>π¬ Result</h3>""")
|
| 538 |
with gr.Row():
|
| 539 |
+
ivm_img_out = gr.Image(label="Dress on Model", type="filepath")
|
| 540 |
ivm_vid_out = gr.Video(label="Looping Video")
|
| 541 |
+
gr.HTML("</div>")
|
| 542 |
|
| 543 |
ivm_btn.click(fn=ivm_generate, inputs=[ivm_dress, ivm_model, ivm_blur, ivm_video],
|
| 544 |
outputs=[ivm_img_out, ivm_vid_out])
|
| 545 |
|
| 546 |
+
# βββββββββββββββ HISTORY TAB βββββββββββββββ
|
| 547 |
+
with gr.TabItem("π History"):
|
| 548 |
+
gr.HTML("""
|
| 549 |
+
<div class="app-topbar">
|
| 550 |
+
<div class="topbar-left">
|
| 551 |
+
<h2>Past Generations</h2>
|
| 552 |
+
<p>All your previously generated V2 videos and IVM images</p>
|
| 553 |
+
</div>
|
| 554 |
+
</div>
|
| 555 |
""")
|
| 556 |
|
| 557 |
+
gr.HTML("""<div class="section-card"><h3>ποΈ V2 Videos</h3>""")
|
| 558 |
+
v2_history_html = gr.HTML(value=refresh_v2_history())
|
| 559 |
+
gr.Button("π Refresh V2 History", size="sm").click(fn=refresh_v2_history, outputs=v2_history_html)
|
| 560 |
+
gr.HTML("</div>")
|
| 561 |
+
|
| 562 |
+
gr.HTML("""<div class="section-card"><h3>π§ IVM Images</h3>""")
|
| 563 |
ivm_history_html = gr.HTML(value=refresh_ivm_history())
|
| 564 |
gr.Button("π Refresh IVM History", size="sm").click(fn=refresh_ivm_history, outputs=ivm_history_html)
|
| 565 |
+
gr.HTML("</div>")
|
| 566 |
+
|
| 567 |
+
# Close app-main and app-wrapper
|
| 568 |
+
gr.HTML("</div></div>")
|
| 569 |
|
| 570 |
|
| 571 |
if __name__ == "__main__":
|