Skip to content

Instantly share code, notes, and snippets.

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

suryak-cs

🏠
Working from home
  • San Francisco, CA
View GitHub Profile
<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>
<!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>
@suryak-cs
suryak-cs / app.py
Created March 18, 2021 10:18
app.py
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))
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.
"""