Spaces:
Runtime error
Runtime error
Fix seed
Browse filesCurrently the seed is ignored, as it is supplied as an unknown parameter (`seed`). Instead, it should be supplied as a generator.
app.py
CHANGED
|
@@ -42,12 +42,15 @@ def predict(input_image, prompt, negative_prompt, steps, num_samples, scale, see
|
|
| 42 |
init_image = input_image.convert("RGB")
|
| 43 |
image = pad_image(init_image) # resize to integer multiple of 32
|
| 44 |
image = image.resize((512, 512))
|
|
|
|
|
|
|
|
|
|
| 45 |
result = dept2img(
|
| 46 |
image=image,
|
| 47 |
prompt=prompt,
|
| 48 |
negative_prompt=negative_prompt,
|
| 49 |
depth_image=depth,
|
| 50 |
-
|
| 51 |
strength=strength,
|
| 52 |
num_inference_steps=steps,
|
| 53 |
guidance_scale=scale,
|
|
|
|
| 42 |
init_image = input_image.convert("RGB")
|
| 43 |
image = pad_image(init_image) # resize to integer multiple of 32
|
| 44 |
image = image.resize((512, 512))
|
| 45 |
+
generator = None
|
| 46 |
+
if seed is not None:
|
| 47 |
+
generator = torch.Generator(device=device).manual_seed(seed)
|
| 48 |
result = dept2img(
|
| 49 |
image=image,
|
| 50 |
prompt=prompt,
|
| 51 |
negative_prompt=negative_prompt,
|
| 52 |
depth_image=depth,
|
| 53 |
+
generator=generator,
|
| 54 |
strength=strength,
|
| 55 |
num_inference_steps=steps,
|
| 56 |
guidance_scale=scale,
|