AkiKagura commited on
Commit
b5ecf2f
1 Parent(s): c8e2317

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -24,10 +24,10 @@ pipe.to(device)
24
 
25
  gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[1], height="auto")
26
 
27
- def infer(prompt):
28
-
29
  #image = pipe(prompt, init_image=init_image)["sample"][0]
30
- images_list = pipe([prompt] * 1, guidance_scale=7.5, num_inference_steps=25, height=512, width=512) #TODO
31
  images = []
32
  for i, image in enumerate(images_list["images"]):
33
  images.append(image)
@@ -39,4 +39,9 @@ print("okay")
39
  title="Marco Generation"
40
  description="Use 'mkmk woman' to get Marco pics. <br />Warning: Slow process... about 10 min inference time."
41
 
42
- gr.Interface(fn=infer, inputs="text", outputs=gallery,title=title,description=description).queue(max_size=10).launch(enable_queue=True)
 
 
 
 
 
 
24
 
25
  gallery = gr.Gallery(label="Generated images", show_label=False, elem_id="gallery").style(grid=[1], height="auto")
26
 
27
+ def infer(prompt, guide, steps, seed, img_w, img_h):
28
+ generator = torch.Generator('cpu').manual_seed(seed)
29
  #image = pipe(prompt, init_image=init_image)["sample"][0]
30
+ images_list = pipe([prompt] * 1, guidance_scale=guide, num_inference_steps=steps, width=img_w, height=img_h) #TODO
31
  images = []
32
  for i, image in enumerate(images_list["images"]):
33
  images.append(image)
 
39
  title="Marco Generation"
40
  description="Use 'mkmk woman' to get Marco pics. <br />Warning: Slow process... about 10 min inference time."
41
 
42
+ gr.Interface(fn=infer, inputs=["text",
43
+ gr.Slider(2, 15, value = 7, label = 'Guidence Scale'),
44
+ gr.Slider(10, 50, value = 25, step = 1, label = 'Number of Iterations'),
45
+ gr.Slider(label = "Seed", minimum = 0, maximum = 2147483647, step = 1, randomize = True),
46
+ gr.Slider(label='Width', minimum = 512, maximum = 768, step = 256, value = 512),
47
+ gr.Slider(label='Height', minimum = 512, maximum = 768, step = 256, value = 512)], outputs=gallery,title=title,description=description).queue(max_size=100).launch(enable_queue=True)