Add a web frontend to a sudoku solver

Project Type
Existing open source project

Add a web frontend to a sudoku solver

I've been working on a python script to solve Sudoku with an image as input. The script does all sorts of image processing to output a 2D matrix and then solve it. I'd like to make a simple website where people can upload their image of Sudoku and have the answer. The next step would be to access the camera of the user to give him the possibility of snapping a photo of his Sudoku. Is anyone interested in doing such a website ? If you're new to web dev it could be a good practice.
Tech Stack
Python, HTML, CSS, JS (node?)
Current Team Size
  • 0
    Sure, why not. I'll circle back in 2 weeks if nobody else is here.
  • 2
    One request though--You have a .rar file added to git.

    I'd recommend looking into git LFS: https://git-lfs.github.com/

    It's a git plugin supported by all the major git hosters, developed for the purpose of handling binary files.

    Perhaps you can do a rewrite and migrate that .rar file on over to LFS. Better yet, don't put the sample images in a .rar file, as every time it changes you have a bunch more diffs than you'd need if you just add one new sample file by itself. Instead just add the folder full of images to LFS recursively.
  • 1
    @taigrr Cool thanks !
    I'll take a look.
  • 0
    why not python? you already have part of your codebase written in it
  • 2
    @calmyourtities I would like a web interface but if you want to use python for the server it's fine.
  • 2
    A web micro framework written in Python (like Flask, though definitely do your own research on the options available) would make sense here since you would be able to import and use your modules directly. (Assuming you have an actual Python API and this isn't just a CLI program)
  • 1
    @tokumei yes that's what I was trying to say to @calmyourtities .
  • 1
    Oh I was definitely going to do any work on this project in flask. It's definitely the right answer for this situation imho
  • 2
    Taking the fun out if sudoku?
  • 3
    @mundo03 It is just a way for me to exercise my computer vision skills.
  • 1
    @MrEliptik and I like it
  • 0
    im interested! few interesting questions:

    how does it handle unsolvable Sudoku?

    can it tell between printed number and written numbers? (say if someone got stuck and uploads a half done Sudoku?)

    if they half solved it, with an error, how does it handle that?

    what if it can't tell a certain number?

    I've written Sudoku solvers before, but never with image processing! this is awesome. I wanna help!
  • 0
    @deadPix3l I'm curious as well. If the model doesn't currently, maybe there's a javascript/canvas fix I can implement, like turning the contrast way high so that only the bolder, darker text is visible. Hmm.
  • 0
    @MrEliptik I'll get started on the 2nd of Dec, again, if nobody else jumps in first and finishes before I get there xD
  • 1
    I was more interested in the computer vision part so the solver is a very naive implementation not optimized at all! For now, it will simply brute force the sudoku, so if there's no solution it returns that its impossible.

    I use a CNN (convolutional neural network) to recognize digit and it is trained on different fonts. I guess I could add the MNIST handwritten dataset to my training for it to better perform with handwritten digits, I'll need to test that.

    In the case the CNN recognize the handwritten digits, it would return that the sudoku is unsolvable.

    For now, the 2D matrix is initialized with -1. So if a number is not recognized the cell will stay at -1. We can use that to ask the user to input it manually for example. In the future that could be used to make the model better.
  • 1
    @deadPix3l The code is not really ready for a general use. It was more of an exercise and I thought it would be cool to see it in action on a webpage. In the future, I want to use an RCNN to do the digit localization because my current method is prone to error if the image is not so good.
  • 1
    @taigrr Cool! :)
  • 2
    @deadPix3l Oh and you could definitely help with the solver if you want! Even with image processing if you like it.
  • 0
    @MrEliptik I find this cool and it's a good chance to play with ML using something I'm at least somewhat family with (Sudoku solving and mnist. it's a cool project.

    so I think something detection should be done to determine if the cell is { printed, handwritten, blank} and disregard all but printed.

    the web page should be pretty easy actually. just some flask code.

    I'm on the case!
  • 1
    My reminder hath pinged me! I'll take a look later today!
  • 1
    @MrEliptik I opened an issue and I'd appreciate if you'd take a look!
  • 1
    @taigrr I'll take a look at lunch
Your Job Suck?
Get a Better Job
Add Comment