Spaces:
Runtime error
Runtime error
Fix seed (#75)
Browse files- Fix seed (681c5498977e01d6825197e5ca7968010fe4f8eb)
- Merge branch 'main' into pr/75 (1553a94271ada2b1e679651225c4666a8be61312)
Co-authored-by: André Knörig <[email protected]>
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_map=depth,
|
50 |
-
seed=seed,
|
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 |
+
generator=generator,
|
53 |
depth_map=depth,
|
|
|
54 |
strength=strength,
|
55 |
num_inference_steps=steps,
|
56 |
guidance_scale=scale,
|