18 lines
650 B
Python
18 lines
650 B
Python
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())
|