Spaces:
Runtime error
Runtime error
code update
Browse files
app.py
CHANGED
|
@@ -255,33 +255,33 @@ def image_generator(prompt = "dog", loss_function=None):
|
|
| 255 |
else:
|
| 256 |
loss_function = None
|
| 257 |
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
this_generated_img_1 = generate_images(prompt,style_num = i,random_seed = seed_values[i],custom_loss_fn = None)
|
| 270 |
images_without_loss.append(this_generated_img_1)
|
| 271 |
if loss_function:
|
| 272 |
this_generated_img_2 = generate_images(prompt,style_num = i,random_seed = seed_values[i],custom_loss_fn = loss_function)
|
| 273 |
images_with_loss.append(this_generated_img_2)
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
generated_sd_images.append((images_without_loss[i], titles[i]))
|
| 280 |
if images_with_loss != []:
|
| 281 |
generated_sd_images.append((images_with_loss[i], titles[i]))
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
|
| 286 |
|
| 287 |
# Create a wrapper function for show_misclassified_images()
|
|
|
|
| 255 |
else:
|
| 256 |
loss_function = None
|
| 257 |
|
| 258 |
+
images_without_loss = []
|
| 259 |
+
images_with_loss = []
|
| 260 |
+
|
| 261 |
+
seed_values = [8,16,50,80,128]
|
| 262 |
+
height = 512 # default height of Stable Diffusion
|
| 263 |
+
width = 512 # default width of Stable Diffusion
|
| 264 |
+
num_inference_steps = 1 # Number of denoising steps
|
| 265 |
+
guidance_scale = 7.5 # Scale for classifier-free guidance
|
| 266 |
+
num_styles = len(style_files)
|
| 267 |
+
|
| 268 |
+
for i in range(num_styles):
|
| 269 |
this_generated_img_1 = generate_images(prompt,style_num = i,random_seed = seed_values[i],custom_loss_fn = None)
|
| 270 |
images_without_loss.append(this_generated_img_1)
|
| 271 |
if loss_function:
|
| 272 |
this_generated_img_2 = generate_images(prompt,style_num = i,random_seed = seed_values[i],custom_loss_fn = loss_function)
|
| 273 |
images_with_loss.append(this_generated_img_2)
|
| 274 |
+
|
| 275 |
+
generated_sd_images = []
|
| 276 |
+
titles = ["Arcane Style", "Birb Style", "Dr Strange Style", "Midjourney Style", "Oil Style"]
|
| 277 |
+
|
| 278 |
+
for i in range(len(titles)):
|
| 279 |
generated_sd_images.append((images_without_loss[i], titles[i]))
|
| 280 |
if images_with_loss != []:
|
| 281 |
generated_sd_images.append((images_with_loss[i], titles[i]))
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
return display_images_in_rows(generated_sd_images, titles)
|
| 285 |
|
| 286 |
|
| 287 |
# Create a wrapper function for show_misclassified_images()
|