Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 Bad Request when passing in url as image argument via HTTP #113

Open
abrichr opened this issue Jan 15, 2022 · 0 comments
Open

400 Bad Request when passing in url as image argument via HTTP #113

abrichr opened this issue Jan 15, 2022 · 0 comments

Comments

@abrichr
Copy link

abrichr commented Jan 15, 2022

When running the model via docker run, POSTing to the endpoint with the image parameter set to a url (with or without the leading @) returns HTTP 400:

{"message": "Could not convert file input image to Path"}

Changing the type to str resolves the issue. Also, the following import is missing:

from urllib.request import urlopen

Edit: we also need to check for an empty string:

--- a/predict.py
+++ b/predict.py
@@ -140,7 +140,7 @@ class Predictor(cog.Predictor):
         toksX, toksY = self.args.size[0] // f, self.args.size[1] // f
         sideX, sideY = toksX * f, toksY * f
 
-        if image is not None:
+        if image:
             self.args.init_image = str(image)
             self.args.step_size = 0.25
             if "http" in self.args.init_image:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant