Spaces:
Running
on
Zero
Running
on
Zero
mrbeliever
commited on
Commit
•
48d37f2
1
Parent(s):
dced90f
Update app.py
Browse files
app.py
CHANGED
@@ -34,9 +34,11 @@ def adjust_to_multiple_of_32(width: int, height: int):
|
|
34 |
@spaces.GPU(duration=120)
|
35 |
def process_images(image, prompt="a girl", strength=0.75, seed=0, inference_step=4, progress=gr.Progress(track_tqdm=True)):
|
36 |
progress(0, desc="Starting")
|
|
|
|
|
|
|
|
|
37 |
def process_img2img(image, prompt="a person", strength=0.75, seed=0, num_inference_steps=4):
|
38 |
-
if image is None:
|
39 |
-
return None
|
40 |
generator = torch.Generator(device).manual_seed(seed)
|
41 |
width, height = convert_to_fit_size(image.size)
|
42 |
width, height = adjust_to_multiple_of_32(width, height)
|
|
|
34 |
@spaces.GPU(duration=120)
|
35 |
def process_images(image, prompt="a girl", strength=0.75, seed=0, inference_step=4, progress=gr.Progress(track_tqdm=True)):
|
36 |
progress(0, desc="Starting")
|
37 |
+
|
38 |
+
if image is None or not hasattr(image, 'size'):
|
39 |
+
raise gr.Error("Please upload an image.")
|
40 |
+
|
41 |
def process_img2img(image, prompt="a person", strength=0.75, seed=0, num_inference_steps=4):
|
|
|
|
|
42 |
generator = torch.Generator(device).manual_seed(seed)
|
43 |
width, height = convert_to_fit_size(image.size)
|
44 |
width, height = adjust_to_multiple_of_32(width, height)
|