Spaces:
Running
on
Zero
Running
on
Zero
wanghaofan
commited on
Commit
•
6726142
1
Parent(s):
16ce666
Update app.py
Browse files
app.py
CHANGED
@@ -43,7 +43,8 @@ model = DepthAnythingV2(**model_configs[encoder])
|
|
43 |
filepath = hf_hub_download(repo_id=f"depth-anything/Depth-Anything-V2-Large", filename=f"depth_anything_v2_vitl.pth", repo_type="model")
|
44 |
state_dict = torch.load(filepath, map_location="cpu")
|
45 |
model.load_state_dict(state_dict)
|
46 |
-
model = model.to(DEVICE).eval()
|
|
|
47 |
|
48 |
import torch
|
49 |
from diffusers.utils import load_image
|
@@ -180,6 +181,8 @@ def infer(cond_in, image_in, prompt, inference_steps, guidance_scale, control_mo
|
|
180 |
guidance_scale=guidance_scale,
|
181 |
generator=torch.manual_seed(seed),
|
182 |
).images[0]
|
|
|
|
|
183 |
|
184 |
return image, control_image, gr.update(visible=True)
|
185 |
|
|
|
43 |
filepath = hf_hub_download(repo_id=f"depth-anything/Depth-Anything-V2-Large", filename=f"depth_anything_v2_vitl.pth", repo_type="model")
|
44 |
state_dict = torch.load(filepath, map_location="cpu")
|
45 |
model.load_state_dict(state_dict)
|
46 |
+
# model = model.to(DEVICE).eval()
|
47 |
+
model = model.eval()
|
48 |
|
49 |
import torch
|
50 |
from diffusers.utils import load_image
|
|
|
181 |
guidance_scale=guidance_scale,
|
182 |
generator=torch.manual_seed(seed),
|
183 |
).images[0]
|
184 |
+
|
185 |
+
torch.cuda.empty_cache()
|
186 |
|
187 |
return image, control_image, gr.update(visible=True)
|
188 |
|