Update handler.py
Browse files- handler.py +8 -1
handler.py
CHANGED
@@ -10,6 +10,8 @@ import numpy as np
|
|
10 |
from moviepy.editor import ImageSequenceClip
|
11 |
import os
|
12 |
import logging
|
|
|
|
|
13 |
|
14 |
# Configure logging
|
15 |
logging.basicConfig(level=logging.INFO)
|
@@ -24,6 +26,11 @@ generator = torch.manual_seed(0)
|
|
24 |
# you can notice we don't use device=cuda, for more info see:
|
25 |
# https://huggingface.co/docs/diffusers/v0.16.0/en/using-diffusers/reproducibility#gpu
|
26 |
|
|
|
|
|
|
|
|
|
|
|
27 |
class EndpointHandler:
|
28 |
# Default configuration
|
29 |
DEFAULT_FPS = 24
|
@@ -135,7 +142,7 @@ class EndpointHandler:
|
|
135 |
|
136 |
# Create temporary file
|
137 |
output_path = tempfile.mktemp(suffix=".mp4")
|
138 |
-
|
139 |
try:
|
140 |
# Create video clip and write to file
|
141 |
clip = ImageSequenceClip(list(video_np), fps=fps)
|
|
|
10 |
from moviepy.editor import ImageSequenceClip
|
11 |
import os
|
12 |
import logging
|
13 |
+
import asyncio
|
14 |
+
from varnish import Varnish
|
15 |
|
16 |
# Configure logging
|
17 |
logging.basicConfig(level=logging.INFO)
|
|
|
26 |
# you can notice we don't use device=cuda, for more info see:
|
27 |
# https://huggingface.co/docs/diffusers/v0.16.0/en/using-diffusers/reproducibility#gpu
|
28 |
|
29 |
+
varnish = Varnish(
|
30 |
+
enable_mmaudio=False,
|
31 |
+
#mmaudio_config=mmaudio_config
|
32 |
+
)
|
33 |
+
|
34 |
class EndpointHandler:
|
35 |
# Default configuration
|
36 |
DEFAULT_FPS = 24
|
|
|
142 |
|
143 |
# Create temporary file
|
144 |
output_path = tempfile.mktemp(suffix=".mp4")
|
145 |
+
|
146 |
try:
|
147 |
# Create video clip and write to file
|
148 |
clip = ImageSequenceClip(list(video_np), fps=fps)
|