JoPmt commited on
Commit
d98f006
·
1 Parent(s): 3afd8c3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -16,15 +16,18 @@ warp = accelerator.prepare(WuerstchenDecoderPipeline.from_pretrained("warp-ai/wu
16
  ###warp.scheduler = DDPMWuerstchenScheduler.from_config(warp.scheduler.config)
17
  warp = warp.to("cpu")
18
  generator = torch.Generator(device="cpu").manual_seed(random.randint(1, 4876364))
19
-
20
  def plex(cook, one, two):
 
21
  ###goof = load_image(img).resize((512, 512))
22
  negative_prompt = "lowres,text,bad quality,low quality,jpeg artifacts,ugly,bad hands,bad face,blurry,bad eyes,watermark,signature"
23
  warp_out = warp_prior(prompt=cook, height=512,width=512,negative_prompt=negative_prompt,guidance_scale=two,timestep=DEFAULT_STAGE_C_TIMESTEPS,num_inference_steps=one)
24
  primpt = ""
25
- imas = warp(image_embeddings=warp_out.image_embeddings, height=512, width=512, num_inference_steps=one, timestep=DEFAULT_STAGE_C_TIMESTEPS,prompt=cook,negative_prompt=primpt,guidance_scale=0.0,output_type="pil").images[0]
26
- return imas
 
 
27
 
28
- iface = gr.Interface(fn=plex,inputs=[gr.Textbox(label="prompt"), gr.Slider(label="Inference steps",minimum=1,step=1,maximum=10,value=5), gr.Slider(label="Prior guidance scale",minimum=4.1,step=0.1,maximum=19.9,value=4.1)],outputs=gr.Image(label="Generated Output Image"), title="Txt2Img Wrstchn SD", description="Txt2Img Wrstchn SD")
29
  iface.queue(max_size=1)
30
  iface.launch(max_threads=1)
 
16
  ###warp.scheduler = DDPMWuerstchenScheduler.from_config(warp.scheduler.config)
17
  warp = warp.to("cpu")
18
  generator = torch.Generator(device="cpu").manual_seed(random.randint(1, 4876364))
19
+ apol=[]
20
  def plex(cook, one, two):
21
+ apol=[]
22
  ###goof = load_image(img).resize((512, 512))
23
  negative_prompt = "lowres,text,bad quality,low quality,jpeg artifacts,ugly,bad hands,bad face,blurry,bad eyes,watermark,signature"
24
  warp_out = warp_prior(prompt=cook, height=512,width=512,negative_prompt=negative_prompt,guidance_scale=two,timestep=DEFAULT_STAGE_C_TIMESTEPS,num_inference_steps=one)
25
  primpt = ""
26
+ imas = warp(image_embeddings=warp_out.image_embeddings, height=512, width=512, num_inference_steps=one, timestep=DEFAULT_STAGE_C_TIMESTEPS,prompt=cook,negative_prompt=primpt,guidance_scale=0.0,output_type="pil")
27
+ for i, igs in enumerate(imas["images"]):
28
+ apol.append(igs)
29
+ return apol
30
 
31
+ iface = gr.Interface(fn=plex,inputs=[gr.Textbox(label="prompt"), gr.Slider(label="Inference steps",minimum=1,step=1,maximum=10,value=5), gr.Slider(label="Prior guidance scale",minimum=4.1,step=0.1,maximum=19.9,value=4.1)],outputs=gr.Gallery(label="Generated Output Image",columns=2), title="Txt2Img Wrstchn SD", description="Txt2Img Wrstchn SD")
32
  iface.queue(max_size=1)
33
  iface.launch(max_threads=1)