huedaya commited on
Commit
f6a1d78
·
1 Parent(s): 8f04d05
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -16,7 +16,7 @@ def indexApi():
16
 
17
  @app.route("/remove", methods = ['POST'])
18
  def removeApi():
19
- image_data = request.form.get("image_data")
20
  key = request.form.get("key")
21
  model = request.form.get("model")
22
 
@@ -35,8 +35,9 @@ def removeApi():
35
 
36
  # response = requests.get(image_url)
37
 
38
- arr = np.asarray(bytearray(image_data), dtype=np.uint8)
39
- image = cv2.imdecode(arr, -1) # 'Load it as it is'
 
40
 
41
  result = remove(image, session=new_session(model))
42
 
 
16
 
17
  @app.route("/remove", methods = ['POST'])
18
  def removeApi():
19
+ image_url = request.form.get("image_url")
20
  key = request.form.get("key")
21
  model = request.form.get("model")
22
 
 
35
 
36
  # response = requests.get(image_url)
37
 
38
+ encoded_data = image_url.split(',')[1]
39
+ arr = np.fromstring(base64.b64decode(encoded_data), np.uint8)
40
+ image = cv2.imdecode(arr, cv2.IMREAD_COLOR)
41
 
42
  result = remove(image, session=new_session(model))
43