Spaces:
Runtime error
Runtime error
Commit
Β·
9d44393
1
Parent(s):
2832d96
Update app.py
Browse files
app.py
CHANGED
|
@@ -113,7 +113,7 @@ print('total upsampler parameters', sum(x.numel() for x in model_up.parameters()
|
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
-
def get_images(batch: th.Tensor, output_size=(
|
| 117 |
""" Display a batch of images inline. """
|
| 118 |
scaled = ((batch + 1)*127.5).round().clamp(0,255).to(th.uint8).cpu()
|
| 119 |
reshaped = scaled.permute(2, 0, 3, 1).reshape([batch.shape[2], -1, 3])
|
|
@@ -121,12 +121,7 @@ def get_images(batch: th.Tensor, output_size=(5, 5)):
|
|
| 121 |
image = ImageOps.fit(image, output_size, Image.ANTIALIAS)
|
| 122 |
return image
|
| 123 |
|
| 124 |
-
|
| 125 |
-
""" Display a batch of images inline. """
|
| 126 |
-
scaled = ((batch + 1)*127.5).round().clamp(0,255).to(th.uint8).cpu()
|
| 127 |
-
reshaped = scaled.permute(2, 0, 3, 1).reshape([batch.shape[2], -1, 3])
|
| 128 |
-
image = Image.fromarray(reshaped.numpy())
|
| 129 |
-
return image
|
| 130 |
|
| 131 |
# Create a classifier-free guidance sampling function
|
| 132 |
guidance_scale = 8.0
|
|
@@ -257,7 +252,7 @@ examples =["melanoma"]
|
|
| 257 |
|
| 258 |
iface = gr.Interface(fn=sample,
|
| 259 |
inputs=gr.inputs.Textbox(label='Which dermoscopic entity would you like to see? Choose one of the following one: "melanoma", "melanocytic nevi", "Actinic keratoses and intraepithelial carcinoma / Bowen disease, "benign keratosis-like lesions (solar lentigines / seborrheic keratoses and lichen-planus like keratoses", "basal cell carcinoma", "dermatofibroma", "vascular lesions"'),
|
| 260 |
-
outputs=gr.outputs.Image(type="pil", label="Model input + completions", width=
|
| 261 |
title=title,
|
| 262 |
description=description,
|
| 263 |
article=article,
|
|
|
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
+
def get_images(batch: th.Tensor, output_size=(256, 256)):
|
| 117 |
""" Display a batch of images inline. """
|
| 118 |
scaled = ((batch + 1)*127.5).round().clamp(0,255).to(th.uint8).cpu()
|
| 119 |
reshaped = scaled.permute(2, 0, 3, 1).reshape([batch.shape[2], -1, 3])
|
|
|
|
| 121 |
image = ImageOps.fit(image, output_size, Image.ANTIALIAS)
|
| 122 |
return image
|
| 123 |
|
| 124 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
# Create a classifier-free guidance sampling function
|
| 127 |
guidance_scale = 8.0
|
|
|
|
| 252 |
|
| 253 |
iface = gr.Interface(fn=sample,
|
| 254 |
inputs=gr.inputs.Textbox(label='Which dermoscopic entity would you like to see? Choose one of the following one: "melanoma", "melanocytic nevi", "Actinic keratoses and intraepithelial carcinoma / Bowen disease, "benign keratosis-like lesions (solar lentigines / seborrheic keratoses and lichen-planus like keratoses", "basal cell carcinoma", "dermatofibroma", "vascular lesions"'),
|
| 255 |
+
outputs=gr.outputs.Image(type="pil", label="Model input + completions", width=64, height=64),
|
| 256 |
title=title,
|
| 257 |
description=description,
|
| 258 |
article=article,
|