simonw / tools

Assorted tools
https://tools.simonwillison.net
Apache License 2.0
173 stars 19 forks source link

OCR usability bug: you have to select language before adding an image #6

Closed simonw closed 5 months ago

simonw commented 5 months ago

Otherwise it goes wrong, but it doesn't give you any feedback to help you spot why it broke.

https://twitter.com/iYousif/status/1774595239182745654

simonw commented 5 months ago

Got Claude 3 Opus to figure it out for me:

curl 'https://tools.simonwillison.net/ocr' | llm -m opus --system '
rewrite this code so when the select box for language is changed the OCR
is re-run against any images currently visible on the page, replacing the text
in their textareas and updating the full document textarea at the top if it is present'

Transcript: https://gist.github.com/simonw/0de241c6adb86808b27841319f0d82b5

simonw commented 5 months ago

It's not perfect: the code doesn't disable the file upload widget or show a page counter while it re-runs OCR, unlike when it runs for the first time. I don't want to spend any more time on this though.

simonw commented 5 months ago

Switching language before you have selected a file should not do this:

bug