Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,14 +56,23 @@ def infer(input_image, prompt, seed=42, randomize_seed=False, guidance_scale=2.5
|
|
| 56 |
"""
|
| 57 |
if randomize_seed:
|
| 58 |
seed = random.randint(0, MAX_SEED)
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
image=
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
return image, seed, gr.update(visible=True)
|
| 68 |
|
| 69 |
css="""
|
|
|
|
| 56 |
"""
|
| 57 |
if randomize_seed:
|
| 58 |
seed = random.randint(0, MAX_SEED)
|
| 59 |
+
|
| 60 |
+
if input_image:
|
| 61 |
+
input_image = input_image.convert("RGB")
|
| 62 |
+
image = pipe(
|
| 63 |
+
image=input_image,
|
| 64 |
+
prompt=prompt,
|
| 65 |
+
guidance_scale=guidance_scale,
|
| 66 |
+
num_inference_steps=steps,
|
| 67 |
+
generator=torch.Generator().manual_seed(seed),
|
| 68 |
+
).images[0]
|
| 69 |
+
else:
|
| 70 |
+
image = pipe(
|
| 71 |
+
prompt=prompt,
|
| 72 |
+
guidance_scale=guidance_scale,
|
| 73 |
+
num_inference_steps=steps,
|
| 74 |
+
generator=torch.Generator().manual_seed(seed),
|
| 75 |
+
).images[0]
|
| 76 |
return image, seed, gr.update(visible=True)
|
| 77 |
|
| 78 |
css="""
|