I have a Flask app deployed in Koyeb. The app has an endpoint ‘/predict’, which accepts a POST request with an image to determine whether the image is fake or real using a pre-trained model.
In local, it works with the following command:
curl -X POST -F "file=@adidas-green.JPG" http://localhost:5000/predict
The app is deployed and healthy. The console message is similar to what I have in local. I tried the following command:
curl -X POST -F "file=@000001.jpg" https://poised-orelie-vepay.koyeb.app/predict
The above command gives the following message:
<p class="text-kgray-40">We are deploying your application. Refresh this page in a few seconds
or check out your deployment status in the Koyeb <a class="text-kgreen-default"
href="https://app.koyeb.com">control
panel</a>.</p>
It seems the error message you see happens during the first deployment of your application. Your application should become eventually healthy after a few seconds (definitely less than 2 minutes), and your POST request should succeed
Is it the case?
If not, I suspect your application does not become healthy. This can be for two reasons:
is your application listening on 0.0.0.0:5000?
in the ports section of your service configuration, did you expose the port 5000?
Thank you for the response. Sorry for the delay in replying from my side.
The error message remained even after hours of deployment and the app is shown as healthy.
I hadn’t bound my application to 0.0.0.0
This is my first time deploying
I tried this now, and I got the response:
error code: 524
My local setup uses Flask local development server which runs on port 5000. As part of the deployment, I used Gunicorn which runs on port 8000. I did expose port 8000 in my service config.
I’m sorry, but I don’t think I’ll be able to help without reproducing the issue. Could you create a minimal repository on github that replicates the issue?
You are just setting up your flask app wrong in my opinion, nothing needs to be bounded to anything, you just need to create a Procfile with this information in it:
web: gunicorn --bind :$PORT app:app
change the app:app to however you have yours and the PORT is passed from Koyeb not what you set. If your instance is running on 8000 as what you specify and you run your flask server on 5000 it cannot talk to each or do an instance health check.
@InfamyStudio Thank you for your response. Apologies for my late reply.
My first deployment didn’t bind to any port and the server showed starting up on 8000, the default port for Gunicorn.
5000 is the default port in the case of the local development server.
I tried as you pointed out. But, still no response. The app shows healthy but the request is time out.
Yes. I don’t have the logs anymore, but it was indeed working on a GPU instance hosted on Koyeb. On a regular instance, it was not working and there were warnings because of the lack of GPUs.
Thank you for the input @David and @Julien_Castets1
We are only in the ideation phase and are trying out free resources. Any suggestions on how we can go about to achieve this?