Manjushri commited on
Commit
f232c2d
1 Parent(s): 6f025fa

Update app.py

Browse files

Added Negative Prompt

Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -14,14 +14,14 @@ def resize(value,img):
14
  img = img.resize((value,value))
15
  return img
16
 
17
- def infer(source_img, prompt, guide, steps, seed, Strength):
18
  generator = torch.Generator(device).manual_seed(seed)
19
  source_image = resize(768, source_img)
20
  source_image.save('source.png')
21
- image = pipe([prompt], init_image=source_image, strength=Strength, guidance_scale=guide, num_inference_steps=steps).images[0]
22
  return image
23
 
24
- gr.Interface(fn=infer, inputs=[gr.Image(source="upload", type="filepath", label="Raw Image. Must Be .png"), gr.Textbox(label = 'Prompt Input Text. 77 Token (Keyword or Symbol) Maximum'),
25
  gr.Slider(2, 15, value = 7, label = 'Guidance Scale'),
26
  gr.Slider(1, 25, value = 10, step = 1, label = 'Number of Iterations'),
27
  gr.Slider(label = "Seed", minimum = 0, maximum = 987654321987654321, step = 1, randomize = True),
 
14
  img = img.resize((value,value))
15
  return img
16
 
17
+ def infer(source_img, prompt, negative_prompt, guide, steps, seed, Strength):
18
  generator = torch.Generator(device).manual_seed(seed)
19
  source_image = resize(768, source_img)
20
  source_image.save('source.png')
21
+ image = pipe(prompt, negative_prompt=negative_prompt, init_image=source_image, strength=Strength, guidance_scale=guide, num_inference_steps=steps).images[0]
22
  return image
23
 
24
+ gr.Interface(fn=infer, inputs=[gr.Image(source="upload", type="filepath", label="Raw Image. Must Be .png"), gr.Textbox(label = 'Prompt Input Text. 77 Token (Keyword or Symbol) Maximum'), gr.Textbox(label='What you Do Not want the AI to generate.')
25
  gr.Slider(2, 15, value = 7, label = 'Guidance Scale'),
26
  gr.Slider(1, 25, value = 10, step = 1, label = 'Number of Iterations'),
27
  gr.Slider(label = "Seed", minimum = 0, maximum = 987654321987654321, step = 1, randomize = True),