I’m trying to upload a model but I everytime I try to run the code I encounter this error:
Traceback (most recent call last):
File “/home/juliocesar/.local/lib/python3.9/site-packages/requests/models.py”, line 910, in json
return complexjson.loads(self.text, **kwargs)
File “/usr/lib/python3.9/json/init.py”, line 346, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.9/json/decoder.py”, line 340, in decode
raise JSONDecodeError(“Extra data”, s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/juliocesar/prueba1.py”, line 5, in
response = requests.post(“http://localhost:80/v1/vision/custom/blip_model",files={"image”:image_data}).json()
File “/home/juliocesar/.local/lib/python3.9/site-packages/requests/models.py”, line 917, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Extra data] 404 page not found: 4
I’m following this procedure:
My model it’s called blip_model.pt and the way I’m uploading it to docker with the following command:
sudo docker run -v /home/juliocesar/my-models/ -p 80:5000 deepquestai/deepstack
my-models is the folder where I located the model.
Next step I try to run the following code:
import requests
image_data = open(“test.jpg”,“rb”).read()
response = requests.post(“http://localhost:80/v1/vision/custom/blip_model",files={"image”:image_data}).json()
for object in response[“predictions”]:
print(object[“label”])
print(response)
When I run the code, the error on the begging pops up.
Is there something wrong with my code or my procedure? I appreciate the help.