Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -30,23 +30,27 @@ def download_model():
|
|
30 |
local_file = os.path.join('./checkpoints/dynamicrafter_1024_v1/', filename)
|
31 |
if not os.path.exists(local_file):
|
32 |
hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='./checkpoints/dynamicrafter_1024_v1/', force_download=True)
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
@spaces.GPU(duration=300)
|
35 |
def infer(image, prompt, steps=50, cfg_scale=7.5, eta=1.0, fs=3, seed=123):
|
36 |
resolution = (576, 1024)
|
37 |
-
download_model()
|
38 |
-
ckpt_path='checkpoints/dynamicrafter_1024_v1/model.ckpt'
|
39 |
-
config_file='configs/inference_1024_v1.0.yaml'
|
40 |
-
config = OmegaConf.load(config_file)
|
41 |
-
model_config = config.pop("model", OmegaConf.create())
|
42 |
-
model_config['params']['unet_config']['params']['use_checkpoint']=False
|
43 |
-
model = instantiate_from_config(model_config)
|
44 |
-
assert os.path.exists(ckpt_path), "Error: checkpoint Not Found!"
|
45 |
-
model = load_model_checkpoint(model, ckpt_path)
|
46 |
-
model.eval()
|
47 |
-
model = model.cuda()
|
48 |
save_fps = 8
|
49 |
-
|
50 |
seed_everything(seed)
|
51 |
transform = transforms.Compose([
|
52 |
transforms.Resize(min(resolution)),
|
@@ -93,7 +97,6 @@ def infer(image, prompt, steps=50, cfg_scale=7.5, eta=1.0, fs=3, seed=123):
|
|
93 |
|
94 |
video_path = './output.mp4'
|
95 |
save_videos(batch_samples, './', filenames=['output'], fps=save_fps)
|
96 |
-
model = model.cpu()
|
97 |
return video_path
|
98 |
|
99 |
|
|
|
30 |
local_file = os.path.join('./checkpoints/dynamicrafter_1024_v1/', filename)
|
31 |
if not os.path.exists(local_file):
|
32 |
hf_hub_download(repo_id=REPO_ID, filename=filename, local_dir='./checkpoints/dynamicrafter_1024_v1/', force_download=True)
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
download_model()
|
37 |
+
ckpt_path='checkpoints/dynamicrafter_1024_v1/model.ckpt'
|
38 |
+
config_file='configs/inference_1024_v1.0.yaml'
|
39 |
+
config = OmegaConf.load(config_file)
|
40 |
+
model_config = config.pop("model", OmegaConf.create())
|
41 |
+
model_config['params']['unet_config']['params']['use_checkpoint']=False
|
42 |
+
model = instantiate_from_config(model_config)
|
43 |
+
assert os.path.exists(ckpt_path), "Error: checkpoint Not Found!"
|
44 |
+
model = load_model_checkpoint(model, ckpt_path)
|
45 |
+
model.eval()
|
46 |
+
model = model.cuda()
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
@spaces.GPU(duration=300)
|
51 |
def infer(image, prompt, steps=50, cfg_scale=7.5, eta=1.0, fs=3, seed=123):
|
52 |
resolution = (576, 1024)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
save_fps = 8
|
|
|
54 |
seed_everything(seed)
|
55 |
transform = transforms.Compose([
|
56 |
transforms.Resize(min(resolution)),
|
|
|
97 |
|
98 |
video_path = './output.mp4'
|
99 |
save_videos(batch_samples, './', filenames=['output'], fps=save_fps)
|
|
|
100 |
return video_path
|
101 |
|
102 |
|