AkashDataScience commited on
Commit
b36e2f1
·
1 Parent(s): 0c1e9f5

Updated defaults

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -221,7 +221,7 @@ def generate_with_guide_loss(num_inference_steps, guidance_scale, seed, text_inp
221
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
222
 
223
  #### ADDITIONAL GUIDANCE ###
224
- if i%5 == 0:
225
  # Requires grad on the latents
226
  latents = latents.detach().requires_grad_()
227
 
@@ -236,7 +236,7 @@ def generate_with_guide_loss(num_inference_steps, guidance_scale, seed, text_inp
236
  loss = guide_loss(denoised_images, loss_type) * loss_scale
237
 
238
  # Occasionally print it out
239
- if i%10==0:
240
  print(i, 'loss:', loss.item())
241
 
242
  # Get gradient
@@ -277,22 +277,22 @@ def inference(text, style, inference_step, guidance_scale, seed, guidance_method
277
 
278
  title = "Stable Diffusion with Textual Inversion"
279
  description = "A simple Gradio interface to infer Stable Diffusion and generate images with different art style"
280
- examples = [["A sweet potato farm", 'Concept', 10, 1.5, 1, 'Grayscale', 100],
281
- ["Sky full of cotton candy", 'Realistic', 10, 3.5, 2, 'Bright', 200],
282
- ["Kittens in the bathtub", 'Line', 10, 5.5, 3, 'Contrast', 300],
283
- ["Water skiing on a lake", 'Ricky', 10, 7.5, 4, 'Symmetry', 400],
284
- ["Miniature pet elephant", 'Plane Scape', 10, 9.5, 5, 'Saturation', 500]]
285
 
286
  demo = gr.Interface(inference,
287
  inputs = [gr.Textbox(label="Prompt", type="text"),
288
  gr.Dropdown(label="Style", choices=['Concept', 'Realistic', 'Line',
289
  'Ricky', 'Plane Scape'], value="Concept"),
290
- gr.Slider(10, 30, 10, step = 5, label="Inference steps"),
291
  gr.Slider(1, 10, 7.5, step = 0.1, label="Guidance scale"),
292
  gr.Slider(0, 10000, 1, step = 1, label="Seed"),
293
  gr.Dropdown(label="Guidance method", choices=['Grayscale', 'Bright', 'Contrast',
294
  'Symmetry', 'Saturation'], value="Grayscale"),
295
- gr.Slider(100, 10000, 100, step = 1, label="Loss scale")],
296
  outputs= [gr.Image(width=320, height=320, label="Generated art"),
297
  gr.Image(width=320, height=320, label="Generated art with guidance")],
298
  title=title,
 
221
  noise_pred = noise_pred_uncond + guidance_scale * (noise_pred_text - noise_pred_uncond)
222
 
223
  #### ADDITIONAL GUIDANCE ###
224
+ if i%3 == 0:
225
  # Requires grad on the latents
226
  latents = latents.detach().requires_grad_()
227
 
 
236
  loss = guide_loss(denoised_images, loss_type) * loss_scale
237
 
238
  # Occasionally print it out
239
+ if i%5==0:
240
  print(i, 'loss:', loss.item())
241
 
242
  # Get gradient
 
277
 
278
  title = "Stable Diffusion with Textual Inversion"
279
  description = "A simple Gradio interface to infer Stable Diffusion and generate images with different art style"
280
+ examples = [["A sweet potato farm", 'Concept', 6, 1.5, 1, 'Grayscale', 100],
281
+ ["Sky full of cotton candy", 'Realistic', 6, 3.5, 2, 'Bright', 200],
282
+ ["Kittens in the bathtub", 'Line', 6, 5.5, 3, 'Contrast', 300],
283
+ ["Water skiing on a lake", 'Ricky', 6, 7.5, 4, 'Symmetry', 400],
284
+ ["Miniature pet elephant", 'Plane Scape', 6, 9.5, 5, 'Saturation', 500]]
285
 
286
  demo = gr.Interface(inference,
287
  inputs = [gr.Textbox(label="Prompt", type="text"),
288
  gr.Dropdown(label="Style", choices=['Concept', 'Realistic', 'Line',
289
  'Ricky', 'Plane Scape'], value="Concept"),
290
+ gr.Slider(10, 30, 6, step = 1, label="Inference steps"),
291
  gr.Slider(1, 10, 7.5, step = 0.1, label="Guidance scale"),
292
  gr.Slider(0, 10000, 1, step = 1, label="Seed"),
293
  gr.Dropdown(label="Guidance method", choices=['Grayscale', 'Bright', 'Contrast',
294
  'Symmetry', 'Saturation'], value="Grayscale"),
295
+ gr.Slider(100, 10000, 200, step = 100, label="Loss scale")],
296
  outputs= [gr.Image(width=320, height=320, label="Generated art"),
297
  gr.Image(width=320, height=320, label="Generated art with guidance")],
298
  title=title,