Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,8 +58,6 @@ def load_models():
|
|
| 58 |
raise
|
| 59 |
|
| 60 |
def generate_tryon(person_img, cloth_img):
|
| 61 |
-
"""CRITICAL: Removed progress parameter - causes API issues"""
|
| 62 |
-
|
| 63 |
print("="*50, file=sys.stderr)
|
| 64 |
print(f"Received - Person: {type(person_img)}, Cloth: {type(cloth_img)}", file=sys.stderr)
|
| 65 |
|
|
@@ -67,13 +65,8 @@ def generate_tryon(person_img, cloth_img):
|
|
| 67 |
raise gr.Error("Both images required!")
|
| 68 |
|
| 69 |
try:
|
| 70 |
-
#
|
| 71 |
-
|
| 72 |
-
person_img = Image.open(person_img).convert('RGB')
|
| 73 |
-
if isinstance(cloth_img, str):
|
| 74 |
-
cloth_img = Image.open(cloth_img).convert('RGB')
|
| 75 |
-
|
| 76 |
-
print("Images converted to PIL", file=sys.stderr)
|
| 77 |
|
| 78 |
load_models()
|
| 79 |
|
|
@@ -108,10 +101,10 @@ def generate_tryon(person_img, cloth_img):
|
|
| 108 |
demo = gr.Interface(
|
| 109 |
fn=generate_tryon,
|
| 110 |
inputs=[
|
| 111 |
-
gr.Image(label="Person Image", type="
|
| 112 |
-
gr.Image(label="Garment Image", type="filepath"
|
| 113 |
],
|
| 114 |
-
outputs=gr.Image(label="Result", type="
|
| 115 |
title="Try-Space Virtual Try-On",
|
| 116 |
description="Upload person and garment images. Processing takes 2-3 minutes on GPU T4.",
|
| 117 |
api_name="generate_tryon",
|
|
|
|
| 58 |
raise
|
| 59 |
|
| 60 |
def generate_tryon(person_img, cloth_img):
|
|
|
|
|
|
|
| 61 |
print("="*50, file=sys.stderr)
|
| 62 |
print(f"Received - Person: {type(person_img)}, Cloth: {type(cloth_img)}", file=sys.stderr)
|
| 63 |
|
|
|
|
| 65 |
raise gr.Error("Both images required!")
|
| 66 |
|
| 67 |
try:
|
| 68 |
+
# person_img and cloth_img are already PIL Images, no conversion needed
|
| 69 |
+
print("Images received as PIL", file=sys.stderr)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
load_models()
|
| 72 |
|
|
|
|
| 101 |
demo = gr.Interface(
|
| 102 |
fn=generate_tryon,
|
| 103 |
inputs=[
|
| 104 |
+
gr.Image(label="Person Image", type="pil"), # Changed from "filepath" to "pil"
|
| 105 |
+
gr.Image(label="Garment Image", type="pil") # Changed from "filepath" to "pil"
|
| 106 |
],
|
| 107 |
+
outputs=gr.Image(label="Result", type="pil"), # Changed from "filepath" to "pil"
|
| 108 |
title="Try-Space Virtual Try-On",
|
| 109 |
description="Upload person and garment images. Processing takes 2-3 minutes on GPU T4.",
|
| 110 |
api_name="generate_tryon",
|