Spaces:
Runtime error
Runtime error
fix the bug of run script
Browse files- README.md +3 -1
- test.png +0 -0
- tryon_inference.py +7 -11
README.md
CHANGED
|
@@ -45,7 +45,9 @@ python tryon_inference.py \
|
|
| 45 |
--image ./example/person/00008_00.jpg \
|
| 46 |
--mask ./example/person/00008_00_mask.png \
|
| 47 |
--garment ./example/garment/00034_00.jpg \
|
| 48 |
-
--seed 42
|
|
|
|
|
|
|
| 49 |
```
|
| 50 |
|
| 51 |
Run the following command to start a gradio demo:
|
|
|
|
| 45 |
--image ./example/person/00008_00.jpg \
|
| 46 |
--mask ./example/person/00008_00_mask.png \
|
| 47 |
--garment ./example/garment/00034_00.jpg \
|
| 48 |
+
--seed 42 \
|
| 49 |
+
--output_tryon test.png \
|
| 50 |
+
--steps 30
|
| 51 |
```
|
| 52 |
|
| 53 |
Run the following command to start a gradio demo:
|
test.png
ADDED
|
tryon_inference.py
CHANGED
|
@@ -42,7 +42,7 @@ def run_inference(
|
|
| 42 |
])
|
| 43 |
|
| 44 |
# Load and process images
|
| 45 |
-
print("image_path", image_path)
|
| 46 |
image = load_image(image_path).convert("RGB").resize(size)
|
| 47 |
mask = load_image(mask_path).convert("RGB").resize(size)
|
| 48 |
garment = load_image(garment_path).convert("RGB").resize(size)
|
|
@@ -79,7 +79,6 @@ def run_inference(
|
|
| 79 |
width = size[0]
|
| 80 |
garment_result = result.crop((0, 0, width, size[1]))
|
| 81 |
tryon_result = result.crop((width, 0, width * 2, size[1]))
|
| 82 |
-
|
| 83 |
|
| 84 |
return garment_result, tryon_result
|
| 85 |
|
|
@@ -88,13 +87,13 @@ def main():
|
|
| 88 |
parser.add_argument('--image', required=True, help='Path to the model image')
|
| 89 |
parser.add_argument('--mask', required=True, help='Path to the agnostic mask')
|
| 90 |
parser.add_argument('--garment', required=True, help='Path to the garment image')
|
| 91 |
-
parser.add_argument('--
|
| 92 |
-
parser.add_argument('--
|
| 93 |
parser.add_argument('--steps', type=int, default=50, help='Number of inference steps')
|
| 94 |
-
parser.add_argument('--
|
| 95 |
parser.add_argument('--seed', type=int, default=0, help='Random seed')
|
| 96 |
-
parser.add_argument('--width', type=int, default=
|
| 97 |
-
parser.add_argument('--height', type=int, default=
|
| 98 |
|
| 99 |
args = parser.parse_args()
|
| 100 |
|
|
@@ -109,11 +108,8 @@ def main():
|
|
| 109 |
seed=args.seed,
|
| 110 |
size=(args.width, args.height)
|
| 111 |
)
|
| 112 |
-
|
| 113 |
-
output_tryon_path=args.output_tryon,
|
| 114 |
|
| 115 |
-
if output_garment_path is not None:
|
| 116 |
-
garment_result.save(output_garment_path)
|
| 117 |
tryon_result.save(output_tryon_path)
|
| 118 |
|
| 119 |
print("Successfully saved garment and try-on images")
|
|
|
|
| 42 |
])
|
| 43 |
|
| 44 |
# Load and process images
|
| 45 |
+
# print("image_path", image_path)
|
| 46 |
image = load_image(image_path).convert("RGB").resize(size)
|
| 47 |
mask = load_image(mask_path).convert("RGB").resize(size)
|
| 48 |
garment = load_image(garment_path).convert("RGB").resize(size)
|
|
|
|
| 79 |
width = size[0]
|
| 80 |
garment_result = result.crop((0, 0, width, size[1]))
|
| 81 |
tryon_result = result.crop((width, 0, width * 2, size[1]))
|
|
|
|
| 82 |
|
| 83 |
return garment_result, tryon_result
|
| 84 |
|
|
|
|
| 87 |
parser.add_argument('--image', required=True, help='Path to the model image')
|
| 88 |
parser.add_argument('--mask', required=True, help='Path to the agnostic mask')
|
| 89 |
parser.add_argument('--garment', required=True, help='Path to the garment image')
|
| 90 |
+
parser.add_argument('--output_garment', default='flux_inpaint_garment.png', help='Output path for garment result')
|
| 91 |
+
parser.add_argument('--output_tryon', default='flux_inpaint_tryon.png', help='Output path for try-on result')
|
| 92 |
parser.add_argument('--steps', type=int, default=50, help='Number of inference steps')
|
| 93 |
+
parser.add_argument('--guidance_scale', type=float, default=30, help='Guidance scale')
|
| 94 |
parser.add_argument('--seed', type=int, default=0, help='Random seed')
|
| 95 |
+
parser.add_argument('--width', type=int, default=576, help='Width')
|
| 96 |
+
parser.add_argument('--height', type=int, default=768, help='Height')
|
| 97 |
|
| 98 |
args = parser.parse_args()
|
| 99 |
|
|
|
|
| 108 |
seed=args.seed,
|
| 109 |
size=(args.width, args.height)
|
| 110 |
)
|
| 111 |
+
output_tryon_path=args.output_tryon
|
|
|
|
| 112 |
|
|
|
|
|
|
|
| 113 |
tryon_result.save(output_tryon_path)
|
| 114 |
|
| 115 |
print("Successfully saved garment and try-on images")
|