From 6e7b3d14106a7fcaa837107acb71864ea2d96203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=BCnk=C3=B6sd=20Marcell?= Date: Thu, 30 Apr 2020 01:19:53 +0200 Subject: [PATCH] Add 'manual_put_model.py' --- manual_put_model.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 manual_put_model.py diff --git a/manual_put_model.py b/manual_put_model.py new file mode 100644 index 0000000..7eb5e9c --- /dev/null +++ b/manual_put_model.py @@ -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() +