tlogandesigns commited on
Commit
45f93b7
·
verified ·
1 Parent(s): c773d9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -11,11 +11,10 @@ from __future__ import annotations
11
  import spaces
12
  import gradio as gr
13
  import numpy as np
14
- from PIL import Image, ImageFilter, ImageEnhance
15
  import tempfile
16
  import os
17
  import random
18
- import time
19
  from typing import Optional
20
  import imageio
21
 
@@ -154,7 +153,7 @@ def generate_ken_burns_video(
154
  num_frames: int,
155
  motion_type: str,
156
  strength: float,
157
- ) -> list[np.ndarray]:
158
  """Create a Ken Burns style animation from a still image."""
159
  img = image.convert("RGB")
160
 
@@ -471,6 +470,7 @@ def generate_ad_headlines(preset: str, seed: int) -> str:
471
  # Main generation pipeline
472
  # ---------------------------------------------------------------------------
473
 
 
474
  def generate_video(
475
  image,
476
  preset: str,
@@ -478,7 +478,7 @@ def generate_video(
478
  video_length: str,
479
  aspect_ratio: str,
480
  motion_strength: str,
481
- seed_value: int,
482
  progress=gr.Progress(),
483
  ):
484
  """Main generation function called by the Gradio interface."""
@@ -490,7 +490,8 @@ def generate_video(
490
 
491
  # Parse inputs
492
  duration = int(video_length.split()[0])
493
- seed = seed_value if seed_value and seed_value > 0 else random.randint(1, 999999)
 
494
 
495
  # Build the prompt
496
  base_prompt = PRESET_PROMPTS.get(preset, "")
@@ -581,12 +582,6 @@ CUSTOM_CSS = """
581
  margin-top: 0;
582
  margin-bottom: 20px;
583
  }
584
- .output-section {
585
- border: 1px solid #e0e0e0;
586
- border-radius: 8px;
587
- padding: 15px;
588
- margin-top: 10px;
589
- }
590
  footer {
591
  text-align: center;
592
  padding: 20px;
 
11
  import spaces
12
  import gradio as gr
13
  import numpy as np
14
+ from PIL import Image
15
  import tempfile
16
  import os
17
  import random
 
18
  from typing import Optional
19
  import imageio
20
 
 
153
  num_frames: int,
154
  motion_type: str,
155
  strength: float,
156
+ ) -> list:
157
  """Create a Ken Burns style animation from a still image."""
158
  img = image.convert("RGB")
159
 
 
470
  # Main generation pipeline
471
  # ---------------------------------------------------------------------------
472
 
473
+ @spaces.GPU
474
  def generate_video(
475
  image,
476
  preset: str,
 
478
  video_length: str,
479
  aspect_ratio: str,
480
  motion_strength: str,
481
+ seed_value,
482
  progress=gr.Progress(),
483
  ):
484
  """Main generation function called by the Gradio interface."""
 
490
 
491
  # Parse inputs
492
  duration = int(video_length.split()[0])
493
+ seed_val = int(seed_value) if seed_value else 0
494
+ seed = seed_val if seed_val > 0 else random.randint(1, 999999)
495
 
496
  # Build the prompt
497
  base_prompt = PRESET_PROMPTS.get(preset, "")
 
582
  margin-top: 0;
583
  margin-bottom: 20px;
584
  }
 
 
 
 
 
 
585
  footer {
586
  text-align: center;
587
  padding: 20px;