LapStore
commited on
Commit
·
c526434
1
Parent(s):
6a8b173
modified back image STEP 1
Browse files
app.py
CHANGED
@@ -26,18 +26,19 @@ def main():
|
|
26 |
async def image_step1(image_file: UploadFile = File(...),background_image: Optional [UploadFile] = File(None),type_of_filters: str = Form(...), blur_radius: str = Form(...)):#--->,background_image: UploadFile = File(...)):
|
27 |
|
28 |
input_to_type_of_filters=None
|
29 |
-
|
30 |
-
if background_image:
|
31 |
-
|
32 |
-
|
|
|
33 |
else:
|
34 |
-
|
35 |
-
|
36 |
contents_img = await image_file.read()
|
37 |
image = Image.open(io.BytesIO(contents_img))
|
38 |
|
39 |
|
40 |
-
produced_image=SegmenterBackground().Back_step1(image,
|
41 |
|
42 |
# Save the processed image to a temporary file
|
43 |
output_file_path_tmp = "/tmp/tmp_processed_image.png"
|
|
|
26 |
async def image_step1(image_file: UploadFile = File(...),background_image: Optional [UploadFile] = File(None),type_of_filters: str = Form(...), blur_radius: str = Form(...)):#--->,background_image: UploadFile = File(...)):
|
27 |
|
28 |
input_to_type_of_filters=None
|
29 |
+
|
30 |
+
if background_image and background_image.filename:
|
31 |
+
contents__back = await image_file.read()
|
32 |
+
image_back = Image.open(io.BytesIO(contents__back))
|
33 |
+
input_to_type_of_filters = image_back
|
34 |
else:
|
35 |
+
input_to_type_of_filters = type_of_filters
|
36 |
+
|
37 |
contents_img = await image_file.read()
|
38 |
image = Image.open(io.BytesIO(contents_img))
|
39 |
|
40 |
|
41 |
+
produced_image=SegmenterBackground().Back_step1(image,input_to_type_of_filters,int(blur_radius))[0]#---->
|
42 |
|
43 |
# Save the processed image to a temporary file
|
44 |
output_file_path_tmp = "/tmp/tmp_processed_image.png"
|