Dev.to · 5 min read

SlothSort demo: open-source AI file tidier (Gemma + Ollama)

SlothSort demo: open-source AI file tidier (Gemma + Ollama)

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady What I Built My Downloads folder has 13 files in it. Half of them are called things like document (3).pdf or scan_0042.pdf, and I have no idea what is inside without opening them. I have been meaning to sort it for [HOW LONG], and I never do. SlothSort does the sorting for me. I point it at a folder and press one button. It reads my documents one by one and suggests a clear name and a folder for each. For example, scan_0042.pdf turned into "Hackathon Meeting Notes". Then it shows me the whole plan, and nothing moves until I press Tidy. I made it careful on purpose. Files are never deleted or overwritten, they move into a Tidied folder inside the folder I picked, and Undo last tidy puts everything back. It is for anyone with a folder they are scared to open. Demo Code Dipti-Choubey-101 / slothsort SlothSort Point it at a messy folder (like Downloads). A local open-weight model reads the start of your documents, suggests a clear name and a folder for each file, and you approve the plan. Files move only after you press Tidy selected, they go into a Tidied folder inside the folder you picked, nothing is ever deleted, and Undo last tidy puts everything back. Your files are read on your laptop through Ollama: no account, no API key, no internet needed after setup. Run (Windows) Install Python 3.11+ (tick Add python.exe to PATH). Install Ollama, then in PowerShell: ollama pull gemma3:4b Double-click run.bat. Your browser opens at http://localhost:5002. How it sorts PDFs, Word files, .txt and .md: the AI reads the first part and picks a folder and a name. Images, videos, installers, archives, spreadsheets, slides: sorted by file type, names unchanged. Skipped: sub-folders… View on GitHub To run it on Windows: install Python and Ollama, run ollama pull gemma3:4b, then double-click run.bat. How I Built It The app is a small Flask server with one page. The interesting part is how little the AI is asked to do. The AI makes one small decision per file. For PDFs, Word files, .txt and .md, plain Python reads the first 1,500 characters. A .docx is just a zip file, so I read the text out of its XML without any extra library, and PDFs go through pypdf. That text goes to gemma3:4b through Ollama, with the original filename and one instruction: pick a folder and write a short clear name. The answer has a fixed shape. Ollama accepts a JSON schema, so I pass one where the folder must be one of five names (Study, Receipts, Work, Personal, Other documents). The model cannot invent a folder. I also set the temperature low (0.2) so it stops getting creative with names. Most files never reach the AI. Images, videos, installers, archives, spreadsheets and slides are sorted by file extension with a lookup table. It is faster, and a 4B model has nothing useful to say about a .zip. The risky part is ordinary code. The AI only returns text. Moving files is plain Python, and only after I press Tidy. File names are stripped of characters Windows doesn't allow, a name that already exists gets (2) added, and every move is written to an undo.json file so it can be reversed. Files changed in the last two minutes are skipped, in case they are still downloading. It shows progress. A scan of 40 files takes a while on a laptop, so the server sends each result as soon as it is ready and the page adds rows one at a time. On my laptop it took about [N MINUTES] for [N] files. What it doesn't do: it does not look inside images, scanned PDFs have no text to read, and a small model sometimes picks a strange name or the wrong folder. That is why you always see the plan first. Why Does Open Innovation Matter? The files in a Downloads folder are bills, assignments and CVs. This is exactly what I don't want to upload to a server, just to get a better file name. Because the model runs through Ollama on my own laptop, the text it reads never leaves it. It is also free to run. A tidier like this is only worth it if I can run it again and again, on every folder, without thinking about a bill. And it was easy to bend to my own needs. The model is one line in app.py. The folder names and the instructions the AI gets are plain text I can change. A bigger hosted model would probably write better names, and it could look inside images, which mine can't. For this project, privacy and zero cost mattered more. The Lazy Payoff I sorted the same 13-file test folder two ways. By hand: 20 minutes 13 seconds, opening every file to work out what it was. With SlothSort: 4 minutes 3 seconds in total. The scan took [2:2], and I did nothing during that time. My own work was [2:1]: reading the plan, clicking or untick on boxes, and pressing Tidy. I start the scan, go and do something else, and come back to a plan I only have to check.I’d point it at a folder I’ve been avoiding, let it read in the background, and only fix the two or three names I don’t like.The AI does the boring part, which is opening every file to see what it is. I do the only part that needs judgment, which is saying yes or no.I wouldn’t trust it blindly, but checking a plan is much easier than making one from scratch.

This is a summary aggregated from Dev.to. Read the complete article on the original site:

Read full article at Dev.to

More AI & Machine Learning News