update
This commit is contained in:
17
Request.py
Normal file
17
Request.py
Normal file
@ -0,0 +1,17 @@
|
||||
import requests
|
||||
import base64
|
||||
import os
|
||||
for image in os.listdir('train'):
|
||||
if 'bak' in image:
|
||||
post_data = {'code': image.split('_')[-2]}
|
||||
# file = {'file':open("train/"+image, 'rb')}
|
||||
with open("train/"+image, 'rb') as open_file:
|
||||
img = base64.b64encode(open_file.read()).decode()
|
||||
image = []
|
||||
image.append(img)
|
||||
post_data['file'] = image
|
||||
resp = requests.post(#url="http://192.168.1.28:5000/predict",
|
||||
url="http://localhost:8084/predict",
|
||||
data=post_data,
|
||||
)#open('36-41/1000026785_45f3_6900068805507_bak.jpg','rb')})
|
||||
print(resp.json())
|
Reference in New Issue
Block a user