Update app.py
Browse files
app.py
CHANGED
@@ -168,17 +168,13 @@ def save_image(img):
|
|
168 |
img.save(unique_name, format="WEBP", lossless=True)
|
169 |
return unique_name
|
170 |
|
171 |
-
# Initialisation globale des modèles
|
172 |
-
device = "cuda"
|
173 |
-
|
174 |
-
# Charger les modèles une seule fois globalement
|
175 |
-
openpose_model.preprocessor.body_estimation.model.to(device)
|
176 |
-
pipe.to(device)
|
177 |
-
pipe.unet_encoder.to(device)
|
178 |
-
|
179 |
@spaces.GPU
|
180 |
def start_tryon(dict, garm_img, garment_des, is_checked, is_checked_crop, denoise_steps, seed, categorie = 'upper_body'):
|
181 |
-
|
|
|
|
|
|
|
|
|
182 |
garm_img = garm_img.convert("RGB").resize((768, 1024))
|
183 |
human_img_orig = dict["background"].convert("RGB")
|
184 |
|
@@ -414,4 +410,4 @@ def get_image(image_id):
|
|
414 |
return jsonify({'error': 'Image not found'}), 404
|
415 |
|
416 |
if __name__ == "__main__":
|
417 |
-
app.run(debug=False, host="0.0.0.0", port=7860)
|
|
|
168 |
img.save(unique_name, format="WEBP", lossless=True)
|
169 |
return unique_name
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
@spaces.GPU
|
172 |
def start_tryon(dict, garm_img, garment_des, is_checked, is_checked_crop, denoise_steps, seed, categorie = 'upper_body'):
|
173 |
+
device = "cuda"
|
174 |
+
openpose_model.preprocessor.body_estimation.model.to(device)
|
175 |
+
pipe.to(device)
|
176 |
+
pipe.unet_encoder.to(device)
|
177 |
+
|
178 |
garm_img = garm_img.convert("RGB").resize((768, 1024))
|
179 |
human_img_orig = dict["background"].convert("RGB")
|
180 |
|
|
|
410 |
return jsonify({'error': 'Image not found'}), 404
|
411 |
|
412 |
if __name__ == "__main__":
|
413 |
+
app.run(debug=False, host="0.0.0.0", port=7860)
|