Skip to content

Chapter 8 image does not open #5

Answered by rehanhaider
ysqander asked this question in Q&A
Discussion options

You must be logged in to vote

OK. What is happening is your response.content is empty and thus raising an error. It is empty because response was the defined earlier in the notebook (beginning of Section 8.5) and your commands seem to be standalone.

These commands needs to be run in the same notebook as where the previous commands were. In the comments notice it says In[4] which means it's the fourth cell in a series of commands.

Alternatively, what you can do is add the following snippet to your 4 lines above and rerun

import requests
file = {"image": open("sample.jpg","rb")} 
headers = {"type": "multipart/image"} 

URL = "http://127.0.0.1:5000" 
filter = "contour" 

response = requests.post(f"{URL}/{filter}",headers…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rehanhaider
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #4 on October 30, 2021 13:46.