Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
|
| 2 |
import gradio as gr
|
| 3 |
from PIL import Image
|
| 4 |
from src.tryon_pipeline import StableDiffusionXLInpaintPipeline as TryonPipeline
|
|
@@ -120,10 +120,10 @@ pipe = TryonPipeline.from_pretrained(
|
|
| 120 |
torch_dtype=torch.float16,
|
| 121 |
)
|
| 122 |
pipe.unet_encoder = UNet_Encoder
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
-
@spaces.GPU
|
| 125 |
-
def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_steps,seed):
|
| 126 |
-
device = "cuda"
|
| 127 |
|
| 128 |
openpose_model.preprocessor.body_estimation.model.to(device)
|
| 129 |
pipe.to(device)
|
|
@@ -177,6 +177,7 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
|
|
| 177 |
with torch.no_grad():
|
| 178 |
prompt = "model is wearing " + garment_des
|
| 179 |
negative_prompt = "monochrome, lowres, bad anatomy, worst quality, low quality"
|
|
|
|
| 180 |
with torch.inference_mode():
|
| 181 |
(
|
| 182 |
prompt_embeds,
|
|
@@ -309,5 +310,5 @@ with image_blocks as demo:
|
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
-
|
| 313 |
|
|
|
|
| 1 |
+
|
| 2 |
import gradio as gr
|
| 3 |
from PIL import Image
|
| 4 |
from src.tryon_pipeline import StableDiffusionXLInpaintPipeline as TryonPipeline
|
|
|
|
| 120 |
torch_dtype=torch.float16,
|
| 121 |
)
|
| 122 |
pipe.unet_encoder = UNet_Encoder
|
| 123 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 124 |
+
pipe = pipe.to(device)
|
| 125 |
+
def start_tryon(dict, garm_img, garment_des, is_checked, is_checked_crop, denoise_steps, seed):
|
| 126 |
|
|
|
|
|
|
|
|
|
|
| 127 |
|
| 128 |
openpose_model.preprocessor.body_estimation.model.to(device)
|
| 129 |
pipe.to(device)
|
|
|
|
| 177 |
with torch.no_grad():
|
| 178 |
prompt = "model is wearing " + garment_des
|
| 179 |
negative_prompt = "monochrome, lowres, bad anatomy, worst quality, low quality"
|
| 180 |
+
|
| 181 |
with torch.inference_mode():
|
| 182 |
(
|
| 183 |
prompt_embeds,
|
|
|
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
+
demo.launch()
|
| 314 |
|