Spaces:
Running
on
Zero
Running
on
Zero
GabrielSalem
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ feature_extractor = CLIPFeatureExtractor.from_pretrained("openai/clip-vit-base-p
|
|
37 |
|
38 |
# Function
|
39 |
@spaces.GPU(duration=1,queue=False)
|
40 |
-
def generate_image(prompt, base="Realistic", motion="", step=8,
|
41 |
global step_loaded
|
42 |
global base_loaded
|
43 |
global motion_loaded
|
@@ -64,21 +64,11 @@ def generate_image(prompt, base="Realistic", motion="", step=8, frame_multiplier
|
|
64 |
def progress_callback(i, t, z):
|
65 |
progress((i+1, step))
|
66 |
|
67 |
-
|
68 |
-
output = pipe(
|
69 |
-
prompt=prompt,
|
70 |
-
guidance_scale=1.2,
|
71 |
-
num_inference_steps=step * frame_multiplier, # More frames
|
72 |
-
callback=progress_callback,
|
73 |
-
callback_steps=1
|
74 |
-
)
|
75 |
|
76 |
name = str(uuid.uuid4()).replace("-", "")
|
77 |
path = f"/tmp/{name}.mp4"
|
78 |
-
|
79 |
-
# Export with lower FPS for longer video
|
80 |
-
export_to_video(output.frames, path, fps=desired_fps)
|
81 |
-
|
82 |
return path
|
83 |
|
84 |
|
|
|
37 |
|
38 |
# Function
|
39 |
@spaces.GPU(duration=1,queue=False)
|
40 |
+
def generate_image(prompt, base="Realistic", motion="", step=8, progress=gr.Progress()):
|
41 |
global step_loaded
|
42 |
global base_loaded
|
43 |
global motion_loaded
|
|
|
64 |
def progress_callback(i, t, z):
|
65 |
progress((i+1, step))
|
66 |
|
67 |
+
output = pipe(prompt=prompt, guidance_scale=1.2, num_inference_steps=step, callback=progress_callback, callback_steps=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
name = str(uuid.uuid4()).replace("-", "")
|
70 |
path = f"/tmp/{name}.mp4"
|
71 |
+
export_to_video(output.frames[0], path, fps=10)
|
|
|
|
|
|
|
72 |
return path
|
73 |
|
74 |
|