Spaces:
Runtime error
Runtime error
Commit
Β·
e2a97fe
1
Parent(s):
7d99fd5
Raise Error on uploading a photo
Browse files
app.py
CHANGED
|
@@ -81,13 +81,13 @@ def transform_ncuda(img,prompt,cfg=8.0,stps=30,sc=0.8):
|
|
| 81 |
img2 = Image.open(io.BytesIO(artifact.binary))
|
| 82 |
return img2
|
| 83 |
except Exception as e:
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
img = img.resize((256,256), Image.ANTIALIAS)
|
| 89 |
-
print(f'Image resizing: (256,256)')
|
| 90 |
-
return transform_ncuda(img,prompt)
|
| 91 |
# img2.save(str(artifact.seed)+ "-img2img.png") # Save our generated image with its seed number as the filename and the img2img suffix so that we know this is our transformed image.
|
| 92 |
|
| 93 |
|
|
@@ -149,7 +149,7 @@ except:
|
|
| 149 |
|
| 150 |
##################
|
| 151 |
def transform(init_image,prompt,n_prompt):
|
| 152 |
-
init_image = init_image.resize((256,256), Image.ANTIALIAS)
|
| 153 |
if cuda_error2==0:
|
| 154 |
try:
|
| 155 |
image1 = pipe1(prompt=prompt, image=init_image, negative_prompt=n_prompt, strength=0.8).images[0]
|
|
|
|
| 81 |
img2 = Image.open(io.BytesIO(artifact.binary))
|
| 82 |
return img2
|
| 83 |
except Exception as e:
|
| 84 |
+
raise gr.Error("Input image from sketch")
|
| 85 |
+
# print(f'Caught error: {e}')
|
| 86 |
+
# logging.warn(f'Caught error: {e}')
|
| 87 |
|
| 88 |
+
# img = img.resize((256,256), Image.ANTIALIAS)
|
| 89 |
+
# print(f'Image resizing: (256,256)')
|
| 90 |
+
# return transform_ncuda(img,prompt)
|
|
|
|
|
|
|
|
|
|
| 91 |
# img2.save(str(artifact.seed)+ "-img2img.png") # Save our generated image with its seed number as the filename and the img2img suffix so that we know this is our transformed image.
|
| 92 |
|
| 93 |
|
|
|
|
| 149 |
|
| 150 |
##################
|
| 151 |
def transform(init_image,prompt,n_prompt):
|
| 152 |
+
# init_image = init_image.resize((256,256), Image.ANTIALIAS)
|
| 153 |
if cuda_error2==0:
|
| 154 |
try:
|
| 155 |
image1 = pipe1(prompt=prompt, image=init_image, negative_prompt=n_prompt, strength=0.8).images[0]
|