Code is running fine with local system but I'm getting the following error whenever I try to submit data to my Flask form:
Error: Method Not Allowed The method is not allowed for the requested URL.
Relevant parts of my code are as follows:
pytesseract.pytesseract.tesseract_cmd = 'C:\\Users\\Abhi\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\site-packages\\pytesseract\\Tesseract-OCR\\tesseract.exe'
#Poppler executable file is mandatory to load
PDFTOPPMPATH = r"C:\Users\Abhi\Downloads\poppler-0.68.0_x86\poppler-0.68.0\bin\pdftoppm.exe"
PDFFILE = "C:\\Users\\Abhi\\rep.pdf"
subprocess.Popen('"%s" -png "%s" out' % (PDFTOPPMPATH, PDFFILE))
app = Flask(__name__)
@app.route('/', methods=['POST'])
def predict():
im = Image.open("out-2.png")
rgb_im = im.convert('RGB')
rgb_im.save('m.jpg')
im = Image.open("m.jpg")
text1 = pytesseract.image_to_string(im, lang = 'eng')
with open("report.txt","w") as f:
f.write(text1)
para = ["Emissivity","Refl. temp.","Distance","Relative humidity","Atmospheric temperature","Transmission"]
f=open('report.txt')
lines=f.readlines()
#lines.remove("\n")
for i in range(0,len(lines)):
if "jpg" in lines[i]:
end1 = i-1
if "MEASUREMENTS (°C)" in lines[i]:
start1 = i+1
if "Report" in lines[i]:
end2 = i-1
if "Transmission" in lines[i]:
trans = i+1
#print(str(start1) + " " + str(end1)+" " +str(trans) + " " + str(end2))
for i in range(start1-1,trans):
return str(lines[i])
if __name__ == '__main__':
#p = int(os.getenv('PORT', 5000))
#app.run(debug = True, port=p, host='0.0.0.0')
#app.run()
app.run(debug=True, use_reloader=False)