LapStore commited on
Commit
182edaa
·
1 Parent(s): 09c99c7

modified putMaskImage to try to solve not doing anything other than replace

Browse files
Files changed (2) hide show
  1. app.py +0 -3
  2. server.py +4 -0
app.py CHANGED
@@ -22,9 +22,6 @@ def main():
22
  return "Hello From Background remover !"
23
 
24
 
25
- @app.post('/imageTry')
26
- async def tmp_function(type_of_filters: str = Form(...), blur_radius: str = Form(...)):
27
- return {"type of filters ":type_of_filters ,"blur radius+2" :int(blur_radius)+2}
28
 
29
  @app.post('/imageStep1')
30
  async def image_step1(image_file: UploadFile = File(...),background_image: Optional [UploadFile] = File(None),type_of_filters: str = Form(...), blur_radius: str = Form(...)):
 
22
  return "Hello From Background remover !"
23
 
24
 
 
 
 
25
 
26
  @app.post('/imageStep1')
27
  async def image_step1(image_file: UploadFile = File(...),background_image: Optional [UploadFile] = File(None),type_of_filters: str = Form(...), blur_radius: str = Form(...)):
server.py CHANGED
@@ -57,12 +57,16 @@ class SegmenterBackground():
57
  # outpt = np.array(background_image.copy())
58
  if(background_image=="cam"):
59
  outpt=np.array(raw_image.filter(ImageFilter.GaussianBlur(radius=blur_radius)))
 
60
  elif(background_image=="remove"):
61
  outpt=np.zeros_like(raw_image)
 
62
  if (type(background_image)==PIL.Image.Image ): # not PIL.JpegImagePlugin.JpegImageFile as resized
63
  #make it last case to not always give replace when uploading same image e.g. as in app , this is easiest way to modify server
64
  #,may be clened in other version
65
  outpt = np.array(background_image.copy())
 
 
66
  else:
67
  raise("Got unexpected Input in background_image")
68
 
 
57
  # outpt = np.array(background_image.copy())
58
  if(background_image=="cam"):
59
  outpt=np.array(raw_image.filter(ImageFilter.GaussianBlur(radius=blur_radius)))
60
+ print("Cam effect")
61
  elif(background_image=="remove"):
62
  outpt=np.zeros_like(raw_image)
63
+ print("remove effect")
64
  if (type(background_image)==PIL.Image.Image ): # not PIL.JpegImagePlugin.JpegImageFile as resized
65
  #make it last case to not always give replace when uploading same image e.g. as in app , this is easiest way to modify server
66
  #,may be clened in other version
67
  outpt = np.array(background_image.copy())
68
+ print("replace effect")
69
+
70
  else:
71
  raise("Got unexpected Input in background_image")
72