chips commited on
Commit
0d060b5
·
1 Parent(s): 93d55f4
Files changed (2) hide show
  1. app.py +7 -8
  2. functions.py +1 -1
app.py CHANGED
@@ -112,18 +112,17 @@ async def run_virtual_tryon_pipeline(
112
  back_type = "double"
113
  print(f"front_type: {front_type}")
114
  print(f"back_type: {back_type}")
 
 
 
115
  if front_type == "double":
116
- front_final_image = combine_images_side_by_side(top_garment_image.read(), bottom_garment_image.read())
117
- print(f"front_combined_image: {front_final_image}")
118
  if back_type == "double":
119
- back_final_image = combine_images_side_by_side(top_back_garment_image.read(), bottom_back_garment_image.read())
120
- print(f"back_combined_image: {back_final_image}")
121
  if front_type == "single":
122
- front_final_image = top_garment_image.read()
123
- print(f"front_combined_image: {front_final_image}")
124
  if back_type == "single":
125
- back_final_image = top_back_garment_image.read()
126
- print(f"back_combined_image: {back_final_image}")
127
  r.set(request_id, "Garment images combined")
128
  #Check incoming data. do we have the required data. Are the images what we expect? (ie flatlay image file etc.)
129
  #lets use openai for this. Also, return errors where needed
 
112
  back_type = "double"
113
  print(f"front_type: {front_type}")
114
  print(f"back_type: {back_type}")
115
+ front_final_image = ""
116
+ back_final_image = ""
117
+
118
  if front_type == "double":
119
+ front_final_image = await combine_images_side_by_side(await top_garment_image.read(), await bottom_garment_image.read())
 
120
  if back_type == "double":
121
+ back_final_image = await combine_images_side_by_side(await top_back_garment_image.read(), await bottom_back_garment_image.read())
 
122
  if front_type == "single":
123
+ front_final_image = await top_garment_image.read()
 
124
  if back_type == "single":
125
+ back_final_image = await top_back_garment_image.read()
 
126
  r.set(request_id, "Garment images combined")
127
  #Check incoming data. do we have the required data. Are the images what we expect? (ie flatlay image file etc.)
128
  #lets use openai for this. Also, return errors where needed
functions.py CHANGED
@@ -4,7 +4,7 @@ from io import BytesIO
4
  import base64
5
  import uuid
6
 
7
- def combine_images_side_by_side(image1: bytes, image2: bytes) -> str:
8
  """
9
  Takes two images, scales them to 1280x1280, combines them side by side,
10
  saves to tmp storage, and returns the base64 encoded image string.
 
4
  import base64
5
  import uuid
6
 
7
+ async def combine_images_side_by_side(image1: bytes, image2: bytes) -> str:
8
  """
9
  Takes two images, scales them to 1280x1280, combines them side by side,
10
  saves to tmp storage, and returns the base64 encoded image string.