JoPmt commited on
Commit
d3ea331
1 Parent(s): 67e460f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -10,13 +10,13 @@ pipe = accelerator.prepare(StableDiffusionXLPipeline.from_pretrained("ptx0/termi
10
  pipe.scheduler = accelerator.prepare(EulerDiscreteScheduler.from_config(pipe.scheduler.config))
11
  pipe.unet.to(memory_format=torch.channels_last)
12
  pipe.to("cpu")
13
-
14
  def plex(prompt,neg_prompt,stips,nut):
15
  apol=[]
16
  if nut == 0:
17
- nm = random.randint(1, 4836928)
18
  while nm % 32 != 0:
19
- nm = random.randint(1, 4836928)
20
  else:
21
  nm=nut
22
  generator = torch.Generator(device="cpu").manual_seed(nm)
@@ -25,6 +25,6 @@ def plex(prompt,neg_prompt,stips,nut):
25
  apol.append(imge)
26
  return apol
27
 
28
- iface = gr.Interface(fn=plex, inputs=[gr.Textbox(label="prompt"),gr.Textbox(label="negative prompt",value="ugly, blurry, poor quality"), gr.Slider(label="num inference steps", minimum=1, step=1, maximum=5, value=5),gr.Slider(label="manual seed (leave 0 for random)", minimum=0,step=32,maximum=4836928,value=0)], outputs=gr.Gallery(label="out", columns=1),description="Running on cpu, very slow! by JoPmt.")
29
  iface.queue(max_size=1,api_open=False)
30
  iface.launch(max_threads=1)
 
10
  pipe.scheduler = accelerator.prepare(EulerDiscreteScheduler.from_config(pipe.scheduler.config))
11
  pipe.unet.to(memory_format=torch.channels_last)
12
  pipe.to("cpu")
13
+ apol=[]
14
  def plex(prompt,neg_prompt,stips,nut):
15
  apol=[]
16
  if nut == 0:
17
+ nm = random.randint(1, 2147483616)
18
  while nm % 32 != 0:
19
+ nm = random.randint(1, 2147483616)
20
  else:
21
  nm=nut
22
  generator = torch.Generator(device="cpu").manual_seed(nm)
 
25
  apol.append(imge)
26
  return apol
27
 
28
+ iface = gr.Interface(fn=plex, inputs=[gr.Textbox(label="prompt"),gr.Textbox(label="negative prompt",value="ugly, blurry, poor quality"), gr.Slider(label="num inference steps", minimum=1, step=1, maximum=5, value=5),gr.Slider(label="manual seed (leave 0 for random)", minimum=0,step=32,maximum=2147483616,value=0)], outputs=gr.Gallery(label="out", columns=1),description="Running on cpu, very slow! by JoPmt.")
29
  iface.queue(max_size=1,api_open=False)
30
  iface.launch(max_threads=1)