Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,12 +5,9 @@ from accelerate import Accelerator
|
|
| 5 |
from transformers import pipeline
|
| 6 |
from diffusers.utils import load_image
|
| 7 |
from diffusers import DiffusionPipeline, DDPMScheduler
|
| 8 |
-
|
| 9 |
from diffusers import WuerstchenDecoderPipeline, WuerstchenPriorPipeline
|
| 10 |
from diffusers.pipelines.wuerstchen import DEFAULT_STAGE_C_TIMESTEPS
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
accelerator = Accelerator(cpu=True)
|
| 15 |
warp_prior = accelerator.prepare(WuerstchenPriorPipeline.from_pretrained("warp-ai/wuerstchen-prior", torch_dtype=torch.bfloat16, use_safetensors=True, safety_cheker=None))
|
| 16 |
###warp_prior.scheduler = DDPMWuerstchenScheduler.from_config(warp_prior.scheduler.config)
|
|
@@ -23,11 +20,11 @@ generator = torch.Generator(device="cpu").manual_seed(random.randint(1, 4876364)
|
|
| 23 |
def plex(cook, one, two):
|
| 24 |
###goof = load_image(img).resize((512, 512))
|
| 25 |
negative_prompt = "lowres,text,bad quality,low quality,jpeg artifacts,ugly,bad hands,bad face,blurry,bad eyes,watermark,signature"
|
| 26 |
-
warp_out = warp_prior(prompt=cook, height=512,width=512,negative_prompt=negative_prompt,guidance_scale=
|
| 27 |
primpt = ""
|
| 28 |
-
imas = warp(warp_out.image_embbedings, height=512, width=512, num_inference_steps=
|
| 29 |
return imas
|
| 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)],
|
| 32 |
iface.queue(max_size=1)
|
| 33 |
iface.launch(max_threads=1)
|
|
|
|
| 5 |
from transformers import pipeline
|
| 6 |
from diffusers.utils import load_image
|
| 7 |
from diffusers import DiffusionPipeline, DDPMScheduler
|
|
|
|
| 8 |
from diffusers import WuerstchenDecoderPipeline, WuerstchenPriorPipeline
|
| 9 |
from diffusers.pipelines.wuerstchen import DEFAULT_STAGE_C_TIMESTEPS
|
| 10 |
|
|
|
|
|
|
|
| 11 |
accelerator = Accelerator(cpu=True)
|
| 12 |
warp_prior = accelerator.prepare(WuerstchenPriorPipeline.from_pretrained("warp-ai/wuerstchen-prior", torch_dtype=torch.bfloat16, use_safetensors=True, safety_cheker=None))
|
| 13 |
###warp_prior.scheduler = DDPMWuerstchenScheduler.from_config(warp_prior.scheduler.config)
|
|
|
|
| 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, num_inference_steps=one,generator=generator,)
|
| 24 |
primpt = ""
|
| 25 |
+
imas = warp(warp_out.image_embbedings, height=512, width=512, num_inference_steps=one, prompt=cook,negative_prompt=primpt,guidance_scale=0.0,output_type="pil",generator=generator).images[0]
|
| 26 |
return imas
|
| 27 |
|
| 28 |
+
iface = gr.Interface(fn=plex,outputs=gr.Image(label="Generated Output Image"),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)], title="Txt2Img Wrstchn SD", description="Txt2Img Wrstchn SD")
|
| 29 |
iface.queue(max_size=1)
|
| 30 |
iface.launch(max_threads=1)
|