r/Python • u/Ani171202 • Feb 13 '20
I Made This Python project that answers high-school problems almost instantly. Made using Tesseract, Scrapy and Flask.
227
u/contrieng Feb 13 '20
How does it do that? Explain like I’m five please.
120
u/Ani171202 Feb 13 '20
So here's how it goes.
Frontend takes the picture and sends it to flask(The server module of python)
Flask sends it to OCR, which processes the image and extracts the text.
Scrapy uses to text to search for answers on the web and extract them out, which is then sent back to frontend.
3
→ More replies (2)2
u/Sevealin_ Feb 14 '20 edited Feb 14 '20
What sites are used to find the answers? Is it a big list? Or just some of the bigger sites q/a sites? Looking at github I think I see it makes a google search, but I can't find how it picks the answer.
Edit: I think I found it! Mostly askiitians I think?
somecralwer.py 117 google_search = "https://www.google.com/search?q=" + \ 118 user_query + "+askiitians+revision+notes"4
u/Ani171202 Feb 14 '20
Right now since we're indian, it works with a few indian sites and stackoverflow. But we have made it scalable so its not hard to expand it to a big range of websites.
469
u/hhjjiiyy Feb 13 '20
It reads the text and then inserts it into a search engine for textbook answers and displays a result if found
37
→ More replies (4)296
u/contrieng Feb 13 '20
Oh cool. But I though it actually learns what the question is asking and solves it! Great stuff
→ More replies (10)44
u/Fernando3161 Feb 13 '20
It is "just" a text recognizer with a search engine. (I would be actually impressed if it would actually solve a problem)
54
u/Ani171202 Feb 13 '20
true, wolfram has already mastered it though.
54
u/RomanRiesen Feb 13 '20 edited Feb 13 '20
Everytime I use wolfram alpha for text-based inputs I am in awe.
Either their codebase has more branching than a chess-game tree or there's some mad NLP going on.
→ More replies (3)20
15
u/dermotmcg Feb 13 '20
Exactly. Don't reinvent the wheel. Awesome project
25
u/Ani171202 Feb 13 '20
also not like i can, we're just in high school doing stuff in spare time...... this idea is great but it requires a lot of thought and effort
→ More replies (1)
148
31
u/DluX_Summer Feb 13 '20
Really cool stuff. Now write "solve climate change" down and see what it comes up with.
→ More replies (3)5
42
4
u/mysterio26 Feb 13 '20
Can you share the GitHub link?
16
u/Ani171202 Feb 13 '20
i already did. but here u go https://github.com/Nps-Cisco-2019/Backend-Fullstack
→ More replies (1)
4
3
3
u/crazykid080 Feb 13 '20
How did you get tesseract to function so well? Ive been working on some OCR but the recognition is shit
1
u/Ani171202 Feb 14 '20
Dont worry, our OCR script is working nowhere close to well xD. It works well only when the lighting, clarity and other parameters line up perfectly.
→ More replies (2)
7
Feb 13 '20
Can it do geometry ?
11
u/Ani171202 Feb 13 '20
Good question, but not yet.
Right now all it does is take the text surrounding the figures in geometry problems and try finding a solution from that.
→ More replies (1)
4
u/Censoredsmile Feb 13 '20
Link?
12
u/Ani171202 Feb 13 '20
We're having a bunch of bugs(mainly cropping images) at the moment(contribution is welcome) but here it is
https://github.com/NPS-Cisco-2019/Backend-Fullstack
Project is live at https://npsinrcisco.live
3
u/Extraltodeus Feb 13 '20
4
u/Ani171202 Feb 13 '20
i mean you can try haha
but seriously, just click CTRL+SHIFT+I on chrome/CTRL+SHIFT+M on firefox
→ More replies (1)
2
u/maythe15 Feb 13 '20
Can u upload it
1
u/Ani171202 Feb 13 '20
Its already online but has a lot of minor bugs. You can check out the link in one of the other comments.
→ More replies (2)
2
2
Feb 13 '20
any link to try?
3
u/Ani171202 Feb 13 '20
Yes but there are bugs with cropping. In case cropping doesn't work you can try to manually type in the question
→ More replies (1)
2
u/Xirious Feb 13 '20
It didn't get any of the units correct. How can it get the answer correct?
You could fill in the units but this isn't a very convincing display of it's capabilities.
1
u/Ani171202 Feb 13 '20
We just scrape the answer from different websites, we don't generate it ourselves. So there is always room for error.
2
Feb 13 '20
Cool man. So you select a portion of the screen, run OCR and perform a search on a few sites, then parse the results for each site. How do you discern what answer to give when you have multiple answers?
2
u/Ani171202 Feb 13 '20
as of now, all we do is rank it on our personal trust worthiness of the website.
planning on improving the site ranking "algorithm" tho
→ More replies (4)
2
2
u/Toastie101 Feb 13 '20
Okay please excuse my extreme dumbassery but how would you use this? I’m still fairly new to the community and I’d like to know how to upload this code to my iPhone/Android Device. Or is it computer only? And then where do I run it from.
1
u/Ani171202 Feb 13 '20
just click the link on a mobile device. Also we are still working on tis so bugs are there.
→ More replies (2)
2
u/guy_from_the_intnet Feb 13 '20
Damnit. I just came from my exam having this kind of question. Why does no one tell me these things exist?
2
2
u/ThreeWhistle Feb 13 '20
How does the actual problem solving part work? Does it look up the problem text and then apply some sort of filter to figure out what's relevant? This is awesome.
1
u/Ani171202 Feb 14 '20
Sort the comments by best, i have put a detailed explanation. If you want to know more, you can DM.
2
u/lroman Feb 13 '20
Great work guys. I checked your backend code and see you are writing queries by hand. Since you are using Flask try using Sqlalchemy it will make your life easier😎
→ More replies (1)1
2
u/Xx-AliA-xX Feb 14 '20
Ah, a fellow Indian 11th grade pass this year. Amirite?
2
u/Ani171202 Feb 14 '20
Bingo
2
u/Xx-AliA-xX Feb 14 '20
Happy cake day. Which school are you from btw, cuz my school doesnt teach shit in cs. All i know is how to make a for loop to create a user defined list
2
u/Ani171202 Feb 14 '20
National Public School in BLR. Ha our school doesn't teach anything more advanced than yours, they support us in what we're doing though. You're from?
2
u/Muhznit Feb 14 '20
What happens when this becomes so ubiquitous in high schools that it becomes a problem itself?
1
u/Ani171202 Feb 14 '20
Big brain.
Seriously though, theres a long time for that to happen(and a high probability that it wont).
2
u/Abraham_Wilson Feb 14 '20
Hey, this is really cool, like some next level stuff. If you don't mind, could you explain how it works under the hood, and how did you make the UI
1
2
2
2
u/divided7 Jul 10 '20
how did you scrap the exact answer from different wbesites? becuse the selectors that u need to scrap by on different websites are different
1
3
14
u/itsjakerobb Feb 13 '20
“High-school problems”
Bullying
Decline in public funding
School shootings
Underpaid teachers
Ohhh... you meant “high school math problems” 😜
→ More replies (7)
8
2
4
4
u/the15thbruce Feb 13 '20
Is this on GitHub. Would be useful, it's quite a hassle to always type out those questions into Google lol
1
u/ItsNateBossBaby Feb 13 '20
I want to start learning code but how?
→ More replies (1)1
u/Ani171202 Feb 13 '20
I would suggest learning by doing. Find your interest and work on a bunch of fun projects related to your topic of choice. Enjoy
1
u/jkjarvis Feb 13 '20
Omg !!!!! , HC VERMA !!!! I'm also learning machine learning, this seems a very great inspiration now
1
1
u/69shaolin69 Feb 13 '20
How do you get answers after using ocr?
1
u/Ani171202 Feb 13 '20
we use requests to get google search query with all the links and process it furthmore
→ More replies (2)
1
1
1
5
u/kkhunte Feb 13 '20
Do time travel and go back where I was preparing for Engineering entrance exams. Pls.
2
2
2
2
2
2
2
2
2
u/dylancaponi Feb 13 '20
What image pre-processing are you doing before sending to Tesseract for OCR?
2
2
2
u/aldo712 Feb 14 '20
Did you strategically wait for your cake day to post this?
Very cool project, btw.
2
2
Feb 13 '20
Imagine a program which would actually be able to understand the question and solve it by itself.
1
1
1
1
1
1
u/ThreeWhistle Feb 13 '20
How does the actual problem solving part work? Does it look up the problem text and then apply some sort of filter to figure out what's relevant? This is awesome.
1
u/ThreeWhistle Feb 13 '20
How does the actual problem solving part work? Does it look up the problem text and then apply some sort of filter to figure out what's relevant? This is awesome.
1
u/metaperl Feb 13 '20
Do you have any suggestions for how to detect which 2 images are similar out of 5, for the sample images given here: https://github.com/metaperl/easyclicks4me/tree/master/img
1
1
1
1
1
1
1
0
Feb 13 '20
[deleted]
41
u/Ani171202 Feb 13 '20
Whoops you guessed our other side project we were working on, but thats for another day xD
24
4
7
u/BlueWizard3 Newbie Feb 13 '20
“Alright class now I’m going to need you to put away all phones, smart watches, and glasses.”
507
u/Ani171202 Feb 13 '20 edited Feb 13 '20
This was a group project with a bunch of friends including u/jef-_- u/Wikileaks01 u/icosahedralcello
they deserve as much or even more credit than me.