Spaces:
Sleeping
Sleeping
Update app.py
Browse files6 unmodified lines78910111218 unmodified lines3132333435363738394041424374 unmodified lines118119120121122123124147 unmodified lines27227327427527627720 unmodified lines2982993003013023033046 unmodified linesfrom diffusers.utils import load_imagefrom peft import PeftModel, LoraConfigdevice = "cuda" if torch.cuda.is_available() else "cpu"model_id_default = "stable-diffusion-v1-5/stable-diffusion-v1-5"18 unmodified linesguidance_scale=7.0,lora_scale=1.0,num_inference_steps=20,controlnet_checkbox=False,controlnet_strength=0.0,controlnet_mode="edge_detection",controlnet_image=None,ip_adapter_checkbox=False,ip_adapter_scale=0.0,ip_adapter_image=None,progress=gr.Progress(track_tqdm=True),):ckpt_dir='./lora_pussinboots_logos'74 unmodified linespipe.to(device)return pipe(**params).images[0]examples = ["Puss in Boots wearing a sombrero crosses the Grand Canyon on a tightrope with a guitar.",147 unmodified linesstep=32,value=512, # Replace with defaults that work for your model)gr.Examples(examples=examples, inputs=[prompt])20 unmodified linescontrolnet_image,ip_adapter_checkbox,ip_adapter_scale,ip_adapter_image,],outputs=[result],)6 unmodified lines789101112131418 unmodified lines3334353637383940414243444574 unmodified lines120121122123124125126127128129130131132147 unmodified lines28028128228328428528628728828929029129229329429529620 unmodified lines3173183193203213223233246 unmodified linesfrom diffusers.utils import load_imagefrom peft import PeftModel, LoraConfigfrom rembg import removedevice = "cuda" if torch.cuda.is_available() else "cpu"model_id_default = "stable-diffusion-v1-5/stable-diffusion-v1-5"18 unmodified linesguidance_scale=7.0,lora_scale=1.0,num_inference_steps=20,controlnet_checkbox=False,controlnet_strength=0.0,controlnet_mode="edge_detection",controlnet_image=None,ip_adapter_checkbox=False,ip_adapter_scale=0.0,remove_bg=None,progress=gr.Progress(track_tqdm=True),):ckpt_dir='./lora_pussinboots_logos'74 unmodified linespipe.to(device)image = pipe(**params).images[0]# Если выбрано удаление фонаif remove_bg:image = remove(image)return imageexamples = ["Puss in Boots wearing a sombrero crosses the Grand Canyon on a tightrope with a guitar.",147 unmodified linesstep=32,value=512, # Replace with defaults that work for your model)# Удаление фона------------------------------------------------------------------------------------------------# Checkbox для удаления фонаwith gr.Blocks():remove_bg = gr.Checkbox(label="Remove Background",value=False,interactive=True)# -------------------------------------------------------------------------------------------------------------gr.Examples(examples=examples, inputs=[prompt])20 unmodified linescontrolnet_image,ip_adapter_checkbox,ip_adapter_scale,ip_adapter_image,remove_bg,],outputs=[result],)
app.py+29-9