Add 'manual_put_model.py'
This commit is contained in:
		
							
								
								
									
										22
									
								
								manual_put_model.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								manual_put_model.py
									
									
									
									
									
										Normal 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()
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user