graphpipe-py
graphpipe-py copied to clipboard
request to https proxy failed
setup server
docker run -it --rm \
-e https_proxy=${https_proxy} \
-p 9000:9000 \
sleepsonthefloor/graphpipe-tf:cpu \
--model=https://oracle.github.io/graphpipe/models/squeezenet.pb \
--listen=0.0.0.0:9000
setup https proxy
go get github.com/yannk/simplehttpsproxy
simplehttpsproxy -host=localhost.test.com -cert=test.crt -key=test.key -listen=localhost:4443 -backend:9000
set host name /etc/hosts
127.0.0.1 localhost.test.com
run curl works curl https://localhost.test.com:4443
but run python client
from io import BytesIO
from PIL import Image, ImageOps
import numpy as np
import requests
from graphpipe import remote
data = np.array(Image.open("mug227.png"))
data = data.reshape([1] + list(data.shape))
data = np.rollaxis(data, 3, 1).astype(np.float32) # channels first
print(data.shape)
pred = remote.execute("https://localhost.test.com:4443", data)
print("Expected 504 (Coffee mug), got: ", np.argmax(pred, axis=1)[0])
get error TypeError: object of type 'int' has no len()