Skip to content

Instantly share code, notes, and snippets.

@godfather68
Created January 18, 2021 19:44
Show Gist options
  • Save godfather68/43a42043d9569d777b437470ced61ecd to your computer and use it in GitHub Desktop.
Save godfather68/43a42043d9569d777b437470ced61ecd to your computer and use it in GitHub Desktop.
import pytesseract # ======= > Add
try:
from PIL import Image
except:
import Image
# Create your views here.
class HomeView(FormView):
form_class = UploadForm
template_name = 'index.html'
success_url = '/'
def form_valid(self, form):
upload = self.request.FILES['file']
print(type(pytesseract.image_to_string(Image.open(upload)))) # =====> add line
return super().form_valid(form)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment