def upload_file(): # check if the post request has the file part if 'file' not in request.files: resp = jsonify({'message': 'No file part in the request'}) resp.status_code = 400 return resp file = request.files['file'] if file.filename == '': resp = jsonify({'message': 'No file selected for uploading'}) resp.status_code = 400 return resp if file and allowed_file(file.filename): filename = secure_filename(file.filename) file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename) file.save(file_path) resp = jsonify({'message': 'File successfully uploaded'}) dpi = 300 documentText, fname = OCR.Convert(file_path, dpi, str(1)) data = Extract.Info(fname) data = Align.restructure(data) return str(data) else: resp = jsonify({'message': 'Allowed file type is pdf'}) resp.status_code = 400 return resp
# In[5]: print(documentText[0]) # # ----XX---- # # # # # ### IMPORT INFORMATION EXTRACTION ( NLP) MODULE # In[6]: import Extract df = pd.DataFrame(Extract.Info(fname)) # In[7]: import Align # In[10]: df_final = Align.Info(df) # ### PRINT FINAL OUTPUT # In[19]: df_final = df_final[0:1] print(df_final)