Skip to content

Instantly share code, notes, and snippets.

View suryak-cs's full-sized avatar
Working from home


Working from home
  • San Francisco, CA
View GitHub Profile
<head><title>Upload Image</title></head>
{% 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>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
<style type="text/css">
span {font-size: 1.6em;}
<H1 ><center>Welcome to LexNLP Demo</center></span></p>
suryak-cs /
Created March 18, 2021 10:18
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
import lexnlp.extract.en.pii
def extract_pii(input_string):
return list(lexnlp.extract.en.pii.get_pii(input_string))
from PIL import Image
except ImportError:
import Image
import pytesseract
def ocr_extraction(filename):
This function will handle the core OCR processing of images.