Flask POST is not working even with method=["POST"] [closed]

I'm trying to do a web-app using Flask, basically 2 html and 1 python files. After doing an input/submit of a value in html#1, the web-app is supposed to go to html#2 with that value and display it, but instead it throws the 501 error. Python code (the function that receives the value is predict)

from flask import Flask, render_template, request
app = Flask(__name__)

import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from tensorflow import keras
@app.route("/")
def home():
    #CODE
    return render_template('home.html')
@app.route('/predict', methods=["POST", "GET"])
def predict():
    #CODE
    return render_template('result.html', result_1 = np.round(pred[0][0]*100,4), result_2 = np.round(pred[0]     [1]*100,4))

Html code (where i do the input)

<form action="/predict" method="post">
<--!CODE-->

I have read several forums on Stack Overflow about this problem but the solutions that users gave have not helped me.

The access log line is ' "POST /predict HTTP/1.1" 501 - ' and the complete error message is:

Error response
Error code: 501

Message: Unsupported method ('POST').

Error code explanation: HTTPStatus.NOT_IMPLEMENTED - Server does not support this operation.


Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation