Add 'manual_put_model.py'

This commit is contained in:
Pünkösd Marcell 2020-04-30 01:19:53 +02:00
parent 7e11249b08
commit 6e7b3d1410
1 changed files with 22 additions and 0 deletions

22
manual_put_model.py Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python3
import requests
import os.path
import json
URL = "http://10.105.115.192/model"
FILE = 'Prototype2500SVM'
files = {
"modelFile": (os.path.basename(FILE), open(FILE,'rb').read(), 'application/octet-stream', {'Content-length' : os.path.getsize(FILE)}),
"meansFile": (os.path.basename(FILE + "MEANS"), open(FILE + "MEANS",'rb').read(), 'application/octet-stream', {'Content-length' : os.path.getsize(FILE + "MEANS")}),
"info" : (None, json.dumps({'type' : 'svm'}), "application/json")
}
r = requests.post(URL,files=files)
print("Content: ", r.content)
print("Headers:", r.headers)
r.raise_for_status()