Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,8 +33,11 @@ save_memory = False
|
|
| 33 |
def load_model():
|
| 34 |
model_path = hf_hub_download('lllyasviel/ControlNet', 'models/control_sd15_scribble.pth')
|
| 35 |
model = create_model('./models/cldm_v15.yaml').cpu()
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
| 38 |
return model
|
| 39 |
|
| 40 |
def process(input_image, prompt, a_prompt, n_prompt, num_samples, image_resolution, detect_resolution, ddim_steps, guess_mode, strength, scale, seed, eta):
|
|
|
|
| 33 |
def load_model():
|
| 34 |
model_path = hf_hub_download('lllyasviel/ControlNet', 'models/control_sd15_scribble.pth')
|
| 35 |
model = create_model('./models/cldm_v15.yaml').cpu()
|
| 36 |
+
if torch.cuda.is_available():
|
| 37 |
+
model.load_state_dict(load_state_dict(model_path, location='cuda'))
|
| 38 |
+
model = model.cuda()
|
| 39 |
+
else:
|
| 40 |
+
model.load_state_dict(load_state_dict(model_path, location='cpu'))
|
| 41 |
return model
|
| 42 |
|
| 43 |
def process(input_image, prompt, a_prompt, n_prompt, num_samples, image_resolution, detect_resolution, ddim_steps, guess_mode, strength, scale, seed, eta):
|