Update app.py
Browse files
app.py
CHANGED
@@ -48,9 +48,9 @@ def generate_and_export_animation(prompt):
|
|
48 |
output = pipe(
|
49 |
prompt=prompt,
|
50 |
negative_prompt="bad quality, worse quality, low resolution, blur",
|
51 |
-
num_frames=
|
52 |
guidance_scale=2.0,
|
53 |
-
num_inference_steps=
|
54 |
)
|
55 |
print('Video frames generated')
|
56 |
|
@@ -58,18 +58,7 @@ def generate_and_export_animation(prompt):
|
|
58 |
with tempfile.NamedTemporaryFile(suffix='.mp4', delete=False) as temp_file:
|
59 |
temp_video_path = temp_file.name
|
60 |
print('temp_video_path', temp_video_path)
|
61 |
-
|
62 |
-
processed_frames = []
|
63 |
-
for frame_tensor in output.frames:
|
64 |
-
# Convert frame tensor to numpy array
|
65 |
-
frame_numpy = frame_tensor.numpy()
|
66 |
-
|
67 |
-
# Append processed frame to the list
|
68 |
-
processed_frames.append(frame_numpy)
|
69 |
-
|
70 |
-
# Export processed frames to a video file
|
71 |
-
export_to_video(processed_frames, temp_video_path)
|
72 |
-
# export_to_video(output.frames, temp_video_path)
|
73 |
|
74 |
with open(temp_video_path, 'rb') as video_file:
|
75 |
video_binary = video_file.read()
|
|
|
48 |
output = pipe(
|
49 |
prompt=prompt,
|
50 |
negative_prompt="bad quality, worse quality, low resolution, blur",
|
51 |
+
num_frames=32,
|
52 |
guidance_scale=2.0,
|
53 |
+
num_inference_steps=18
|
54 |
)
|
55 |
print('Video frames generated')
|
56 |
|
|
|
58 |
with tempfile.NamedTemporaryFile(suffix='.mp4', delete=False) as temp_file:
|
59 |
temp_video_path = temp_file.name
|
60 |
print('temp_video_path', temp_video_path)
|
61 |
+
export_to_video(output.frames[0], temp_video_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
with open(temp_video_path, 'rb') as video_file:
|
64 |
video_binary = video_file.read()
|