alex-remade commited on
Commit
722a50c
·
1 Parent(s): 719dba0

Much better styling for page along with discord nudge

Browse files
Files changed (1) hide show
  1. app.py +168 -7
app.py CHANGED
@@ -244,11 +244,11 @@ async def generate_video(input_image, subject, duration, selected_index, progres
244
  "dimensions": None,
245
  "input_image_url": image_url,
246
  "video_length": {"duration": video_duration},
247
- "platform": "huggingface"
248
  },
249
  "error": None,
250
  "output_url": None,
251
- "batch_id": None
 
252
  }
253
 
254
  # Remove await - the execute() method returns the response directly
@@ -323,6 +323,90 @@ css = '''
323
  .progress-bar {height: 100%;background-color: #90EE90;width: calc(var(--current) / var(--total) * 100%);transition: width 0.5s ease-in-out}
324
  .progress-text {position: absolute;width: 100%;text-align: center;top: 50%;left: 0;transform: translateY(-50%);color: #000;font-weight: bold;}
325
  .refresh-warning {color: #e74c3c;font-weight: bold;text-align: center;margin-top: 5px;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
326
  '''
327
 
328
  with gr.Blocks(css=css) as demo:
@@ -330,6 +414,16 @@ with gr.Blocks(css=css) as demo:
330
  current_generation_id = gr.State(None)
331
 
332
  gr.Markdown("# Remade AI - Wan 2.1 I2V effects LoRAs ")
 
 
 
 
 
 
 
 
 
 
333
  selected_info = gr.HTML("")
334
 
335
  with gr.Row():
@@ -344,27 +438,94 @@ with gr.Blocks(css=css) as demo:
344
  height="350px",
345
  object_fit="contain"
346
  )
 
 
 
 
 
 
 
 
347
  input_image = gr.Image(type="filepath")
348
  subject = gr.Textbox(label="Describe your subject", placeholder="Cat toy")
349
- duration = gr.Radio(["Short (3s)", "Long (5s)"], label="Duration", value="Short (3s)")
350
- button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
 
352
  with gr.Column(scale=1):
353
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
354
  output = gr.Video(interactive=False, label="Output video")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
 
356
  gallery.select(
357
  update_selection,
358
  outputs=[selected_index, selected_info]
359
  )
360
 
361
- # Use gr.on for the button click to match the example
362
- gr.on(
363
- triggers=[button.click],
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  fn=handle_generation,
365
  inputs=[input_image, subject, duration, selected_index],
366
  outputs=[output, current_generation_id, progress_bar]
367
  )
 
 
 
 
 
 
 
368
 
369
  if __name__ == "__main__":
370
  demo.queue()
 
244
  "dimensions": None,
245
  "input_image_url": image_url,
246
  "video_length": {"duration": video_duration},
 
247
  },
248
  "error": None,
249
  "output_url": None,
250
+ "batch_id": None,
251
+ "platform": "huggingface"
252
  }
253
 
254
  # Remove await - the execute() method returns the response directly
 
323
  .progress-bar {height: 100%;background-color: #90EE90;width: calc(var(--current) / var(--total) * 100%);transition: width 0.5s ease-in-out}
324
  .progress-text {position: absolute;width: 100%;text-align: center;top: 50%;left: 0;transform: translateY(-50%);color: #000;font-weight: bold;}
325
  .refresh-warning {color: #e74c3c;font-weight: bold;text-align: center;margin-top: 5px;}
326
+
327
+ /* Improved Discord styling */
328
+ .discord-banner {
329
+ background: linear-gradient(135deg, #5865F2 0%, #404EED 100%);
330
+ color: white;
331
+ padding: 20px;
332
+ border-radius: 12px;
333
+ margin: 15px 0;
334
+ text-align: center;
335
+ box-shadow: 0 4px 6px rgba(0,0,0,0.1);
336
+ }
337
+ .discord-banner h3 {
338
+ margin-top: 0;
339
+ font-size: 1.5em;
340
+ text-shadow: 0 1px 2px rgba(0,0,0,0.2);
341
+ }
342
+ .discord-banner a {
343
+ display: inline-block;
344
+ background-color: white;
345
+ color: #5865F2;
346
+ text-decoration: none;
347
+ font-weight: bold;
348
+ padding: 8px 16px;
349
+ border-radius: 20px;
350
+ margin-top: 10px;
351
+ transition: all 0.2s ease;
352
+ box-shadow: 0 2px 4px rgba(0,0,0,0.2);
353
+ }
354
+ .discord-banner a:hover {
355
+ transform: translateY(-2px);
356
+ box-shadow: 0 4px 8px rgba(0,0,0,0.2);
357
+ }
358
+ .discord-feature {
359
+ background-color: #F6F6F6;
360
+ border-left: 4px solid #5865F2;
361
+ padding: 12px 15px;
362
+ margin: 10px 0;
363
+ border-radius: 0 8px 8px 0;
364
+ box-shadow: 0 2px 4px rgba(0,0,0,0.05);
365
+ }
366
+ .discord-feature-title {
367
+ font-weight: bold;
368
+ color: #5865F2;
369
+ }
370
+ .discord-locked {
371
+ opacity: 0.7;
372
+ position: relative;
373
+ pointer-events: none;
374
+ }
375
+ .discord-locked::after {
376
+ content: "🔒 Discord members only";
377
+ position: absolute;
378
+ top: 50%;
379
+ left: 50%;
380
+ transform: translate(-50%, -50%);
381
+ background: rgba(88,101,242,0.9);
382
+ color: white;
383
+ padding: 5px 10px;
384
+ border-radius: 20px;
385
+ white-space: nowrap;
386
+ font-size: 0.9em;
387
+ font-weight: bold;
388
+ box-shadow: 0 2px 4px rgba(0,0,0,0.2);
389
+ }
390
+ .discord-benefits-list {
391
+ text-align: left;
392
+ display: inline-block;
393
+ margin: 10px 0;
394
+ }
395
+ .discord-benefits-list li {
396
+ margin: 8px 0;
397
+ position: relative;
398
+ padding-left: 25px;
399
+ }
400
+ .discord-benefits-list li::before {
401
+ content: "✨";
402
+ position: absolute;
403
+ left: 0;
404
+ color: #FFD700;
405
+ }
406
+ .locked-option {
407
+ opacity: 0.6;
408
+ cursor: not-allowed;
409
+ }
410
  '''
411
 
412
  with gr.Blocks(css=css) as demo:
 
414
  current_generation_id = gr.State(None)
415
 
416
  gr.Markdown("# Remade AI - Wan 2.1 I2V effects LoRAs ")
417
+
418
+ # Discord banner at the top
419
+ discord_banner = gr.HTML(
420
+ """<div class="discord-banner">
421
+ <h3>✨ Unlock Premium Features! ✨</h3>
422
+ <p>Join our Discord community to access longer videos, 100+ LoRAs, audio features, and faster generation times!</p>
423
+ <a href="https://discord.gg/remade-1" target="_blank">Join Discord Now</a>
424
+ </div>"""
425
+ )
426
+
427
  selected_info = gr.HTML("")
428
 
429
  with gr.Row():
 
438
  height="350px",
439
  object_fit="contain"
440
  )
441
+
442
+ # Discord feature callout for LoRAs
443
+ gr.HTML(
444
+ """<div class="discord-feature">
445
+ <span class="discord-feature-title">✨ Discord Members:</span> Access 100+ additional LoRAs beyond these 3 samples!
446
+ </div>"""
447
+ )
448
+
449
  input_image = gr.Image(type="filepath")
450
  subject = gr.Textbox(label="Describe your subject", placeholder="Cat toy")
451
+
452
+ # Modified duration options - only one active option
453
+ duration = gr.Radio(
454
+ ["Short (3s)"],
455
+ label="Duration",
456
+ value="Short (3s)"
457
+ )
458
+
459
+ # Add disabled duration option with Discord callout
460
+ gr.HTML(
461
+ """<div class="discord-feature">
462
+ <span class="discord-feature-title">⏱️ Discord Members:</span> Access longer video durations (up to 10 seconds)!
463
+ </div>"""
464
+ )
465
+
466
+ # Add disabled audio button with Discord callout
467
+ with gr.Row():
468
+ button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
469
+ audio_button = gr.Button("Add Audio 🔒", interactive=False)
470
+
471
+ # Discord feature callout for generation speed
472
+ gr.HTML(
473
+ """<div class="discord-feature">
474
+ <span class="discord-feature-title">⚡ Discord Members:</span> Enjoy priority queue with faster generation times!
475
+ </div>"""
476
+ )
477
 
478
  with gr.Column(scale=1):
479
  progress_bar = gr.Markdown(elem_id="progress", visible=False)
480
  output = gr.Video(interactive=False, label="Output video")
481
+
482
+ # Discord feature summary at the bottom
483
+ gr.HTML(
484
+ """<div class="discord-banner" style="margin-top: 20px;">
485
+ <h3>Join our Discord to unlock:</h3>
486
+ <ul class="discord-benefits-list">
487
+ <li>Longer video durations (up to 10 seconds)</li>
488
+ <li>100+ creative LoRAs to choose from</li>
489
+ <li>Audio generation features</li>
490
+ <li>Priority queue with faster generation</li>
491
+ <li>Community support and inspiration</li>
492
+ </ul>
493
+ <a href="https://discord.gg/remade" target="_blank">Join Discord Now</a>
494
+ </div>"""
495
+ )
496
 
497
  gallery.select(
498
  update_selection,
499
  outputs=[selected_index, selected_info]
500
  )
501
 
502
+ # Add a custom handler to check if inputs are valid
503
+ def check_inputs(subject, input_image, selected_index):
504
+ if not selected_index:
505
+ return gr.Error("You must select a LoRA before proceeding.")
506
+ if not subject.strip():
507
+ return gr.Error("Please describe your subject.")
508
+ if input_image is None:
509
+ return gr.Error("Please upload an image.")
510
+ return None
511
+
512
+ # Use gr.on for the button click with validation
513
+ button.click(
514
+ fn=check_inputs,
515
+ inputs=[subject, input_image, selected_index],
516
+ outputs=None
517
+ ).success(
518
  fn=handle_generation,
519
  inputs=[input_image, subject, duration, selected_index],
520
  outputs=[output, current_generation_id, progress_bar]
521
  )
522
+
523
+ # Add a click handler for the disabled audio button
524
+ audio_button.click(
525
+ fn=lambda: gr.Info("Join our Discord to unlock audio generation features!"),
526
+ inputs=None,
527
+ outputs=None
528
+ )
529
 
530
  if __name__ == "__main__":
531
  demo.queue()