yuragoithf
commited on
Commit
·
7fdbcb9
1
Parent(s):
6405396
Update app.py
Browse files
app.py
CHANGED
@@ -16,8 +16,15 @@ def query(filename):
|
|
16 |
return response.json()
|
17 |
|
18 |
def rb(img):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
# response = requests.post(API_URL, headers=headers, data=bytes(img.tobytes("raw")))
|
20 |
-
response = requests.post(API_URL, headers=headers, data=
|
21 |
return response.json()
|
22 |
|
23 |
# train = os.listdir("./")
|
|
|
16 |
return response.json()
|
17 |
|
18 |
def rb(img):
|
19 |
+
# initialiaze io to_bytes converter
|
20 |
+
img_byte_arr = io.BytesIO()
|
21 |
+
# define quality of saved array
|
22 |
+
img.save(img_byte_arr, format='JPEG', subsampling=0, quality=100)
|
23 |
+
# converts image array to bytesarray
|
24 |
+
img_byte_arr = img_byte_arr.getvalue()
|
25 |
+
|
26 |
# response = requests.post(API_URL, headers=headers, data=bytes(img.tobytes("raw")))
|
27 |
+
response = requests.post(API_URL, headers=headers, data=img_byte_arr)
|
28 |
return response.json()
|
29 |
|
30 |
# train = os.listdir("./")
|