Johdw commited on
Commit
47cef4f
·
verified ·
1 Parent(s): cdf831f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -7
main.py CHANGED
@@ -124,12 +124,12 @@ async def api_generate(request: Request, inputs: ApiInput):
124
  # Load person and fabric images from base64
125
  person = load_image_from_base64(inputs.person_base64)
126
  fabric = load_image_from_base64(inputs.fabric_base64)
127
- if inputs.mask_base64 and inputs.mask_base64 != "" :
128
- mask = load_image_from_base64(inputs.mask_base64, mode='L')
129
- print( "Load image from base64 for mask image ..." );
130
- else:
131
- mask = generate_ultimate_mask(person_resized)
132
- print( "Generating the mask image ..." );
133
 
134
  if person is None or fabric is None:
135
  raise HTTPException(status_code=400, detail="Could not decode base64 images.")
@@ -139,7 +139,7 @@ async def api_generate(request: Request, inputs: ApiInput):
139
  person_resized = person.resize(TARGET_SIZE, Image.Resampling.LANCZOS)
140
 
141
  # Handle mask image if provided
142
- if inputs.mask_base64:
143
  mask = load_image_from_base64(inputs.mask_base64, mode='L')
144
  if mask is None:
145
  raise HTTPException(status_code=400, detail="Could not decode mask base64.")
 
124
  # Load person and fabric images from base64
125
  person = load_image_from_base64(inputs.person_base64)
126
  fabric = load_image_from_base64(inputs.fabric_base64)
127
+ # if inputs.mask_base64 and inputs.mask_base64 != "" :
128
+ # mask = load_image_from_base64(inputs.mask_base64, mode='L')
129
+ # print( "Load image from base64 for mask image ..." );
130
+ # else:
131
+ # mask = generate_ultimate_mask(person_resized)
132
+ # print( "Generating the mask image ..." );
133
 
134
  if person is None or fabric is None:
135
  raise HTTPException(status_code=400, detail="Could not decode base64 images.")
 
139
  person_resized = person.resize(TARGET_SIZE, Image.Resampling.LANCZOS)
140
 
141
  # Handle mask image if provided
142
+ if inputs.mask_base64 and inputs.mask_base64 != "":
143
  mask = load_image_from_base64(inputs.mask_base64, mode='L')
144
  if mask is None:
145
  raise HTTPException(status_code=400, detail="Could not decode mask base64.")