This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Upload Image</title></head> | |
<body> | |
<center> | |
{% if msg %} | |
<p class = "p3">{{ msg }}</p> | |
{% endif %} | |
<h1>Upload new File</h1> | |
<form method=post enctype=multipart/form-data> | |
<p><input type=file name=file> <input type=submit value=Upload> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title>Index</title> | |
<style type="text/css"> | |
span {font-size: 1.6em;} | |
</style> | |
</head> | |
<body> | |
<H1 ><center>Welcome to LexNLP Demo</center></span></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from flask import Flask, render_template, request | |
from ocr_extraction import ocr_extraction,pdf_extract | |
from lexnlp_extraction import extract_pii | |
# define folder to save the uploaded image | |
UPLOAD_FOLDER = 'static/uploads/' | |
# Allowed file image file extension type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import lexnlp.extract.en.pii | |
def extract_pii(input_string): | |
return list(lexnlp.extract.en.pii.get_pii(input_string)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
from PIL import Image | |
except ImportError: | |
import Image | |
import pytesseract | |
def ocr_extraction(filename): | |
""" | |
This function will handle the core OCR processing of images. | |
""" |