H12(Request) Timeout Error in Heroku on Deployment

I recently deployed my server on Heroku. The project aims to predict digits drawn on the canvas by the user. The project link is : https://github.com/tanishq9/MNIST-NodeJS.

The image drawn on canvas (using p5.js) is encoded and send to the backend for inference. At the backend the image is decoded and is saved on the server. This saved image is then send to a python script which outputs the predicted digit and sends this as a response.

Please run the code on your local machine and deploy it on Heroku. Let me where I got it wrong. Thanks.

P.S : The code runs perfectly for localhost but not on deployment.

Not working on my localhost.
Python stacktrace:

    Traceback (most recent call last):
    File "/Users/anirudh/Desktop/MNIST-NodeJS/model.py", line 2, in <module>
    from keras.models import load_model
    ImportError: No module named keras.models

install keras on your local machine

You need to setup python related stuffs on heroku server.
Refer this:

Another error !

That error is self explanatory.

Not enough.Please elaborate. Also,wouldn’t have raised a doubt if it was ‘SELF-EXPLANATORY’

Provide --app “app_name” at end of command.
You must atleast learn to read the error and understand it.

The error is obvious. Looks like you didn’t understand the doubt well enough. I was asking where should I write this line , after the set buildpacks ?

next step after adding buildpack ?

Heroku logs :

Are you getting “sending the response” log after your error log?

I get error status 503 which is because the server wasn’t able to send something in response , also known as request timeout. In localhost it was sending a response because python script was running in the backend and sending some output. But when deployed on heroku , I think the python script doesn’t even run and hence no response is send back. So, that causes a timeout.

Now, I have added python buildpack , but still the same error status persists.
The text selected in the screenshot is what I get when send request to the server.(Usually the error comes after ~30 seconds of getting no response which is also time limit for request timeout)

Just checked it out and deployed myself.
Your python program encounters error on heroku

ModuleNotFoundError: No module named 'tensorflow'

Since I only know python basics, see how to solve this python related error.

I asked you to deploy the server in the doubt itself and now you have deployed after 15 comments. If you don’t know , you can leave it and ask some other TA to take up this doubt.

Ok. I leave it for @Darsh-Pratap-325457197922299.

@Darsh-Pratap-325457197922299 Pls solve his Python doubt.

I have resolved the issue and now I am getting the desired output.
The updated source code is at : https://github.com/tanishq9/MNIST-NodeJS
Now , there’s another issue. Earlier only one picture was being overwritten and saved in the backend named ‘input.png’. But what if 2 users want to access predict their digits simultaneously. In that case, both of them get the same output if the ‘Predict’ button is pressed by both clients at the same time. But if I start saving picture in the backend for every press of ‘Predict button’ then won’t too much space will be used. Is there any storage limitation on heroku ? Is my idea for storing different images making any sense ? Please tell. Would be easier if you run the project in your system as well.

Getting the same answer by pressing button at the same time by two different users, is not the desired output right?
If not, then for different users, u need to store different images to get the desired solution, if u r worried about the space issue, then u can use the third party like minio to store images.

Yes, that is not the desired output. So , storing it on server deployed on heroku is a bad idea ?