Flask User Interface not redirecting to prediction layout
mashood57 opened this issue · 2 comments
Hello, I'm a beginner in ML, I'm trying to execute your project for my study purpose and when I run the script deploy.py with powershell, the server execute and when I try to upload image and click on classify, it refreshes the page and is not showing the predicted layout.
This is what error says:
127.0.0.1 - - [05/Aug/2021 04:54:13] "POST /predict HTTP/1.1" 404 -
Exception
Expecting value: line 1 column 1 (char 0)
I thought there might be url problem as the class of predict.html is with def pred_page() so when I do change the url from:
with open(os.path.join(app.config['UPLOAD_FOLDER'], filename),'rb') as img:
predicted = requests.post("http://localhost:3000/predict", files={"file": img}).json()
to
with open(os.path.join(app.config['UPLOAD_FOLDER'], filename),'rb') as img:
predicted = requests.post("http://localhost:3000/pred_page", files={"file": img}).json()
it shows this error:
127.0.0.1 - - [05/Aug/2021 05:04:41] "POST /pred_page HTTP/1.1" 405 -
Exception
Expecting value: line 1 column 1 (char 0)
Can u help me out on this? There were some missing Import JSON line that I have added during debugging.
Thank You
Are you running both app.py
and deploy.py
? The app.py
contains the model's REST API code and the deploy.py
is for the web application.
Are you running both
app.py
anddeploy.py
? Theapp.py
contains the model's REST API code and thedeploy.py
is for the web application.
No, I was not doing this, thank you for your quick response.
It is working now. You are Amazing 👍 I'll definitely ask if I need to ask more, again thank you for your quick response.