DEV Community

Abhinav Singh
Abhinav Singh

Posted on

Sloth Sorter: A Local AI That Organizes Files So You Don't Have To ๐Ÿฆฅ

๐Ÿฆฅ Sloth Sorter - Local AI File Sorter

Have you ever looked at your downloads folder only to be greeted by hundreds of files?

Sorting these manually can take some time so I decided to create a tool to help with this.

Sloth Sorter is a local AI file organiser built with Python, Streamlit, Ollama and Gemma 3.

This was created as part of the Hacktoberfest Open-Source AI Challenge - Week 3: Slow and Steady.

๐Ÿ’ก Idea

The idea is to have the AI do the boring work of sorting files whilst you do more important tasks.

Instead of manually opening each file to determine where it goes and what to rename it to, Sloth Sorter will provide suggestions for the correct categories and names.

Overall making it easier to sort files and looking into the potential of local AI.

๐Ÿš€ What is Sloth Sorter?

Sloth Sorter is a Python app that helps organise files with a local AI model.

It has been built to:

Scan through selected folder(s) and get file information.

Provide suggested categories for files using a local model.

Provide suggested meaningful names for files.

Review suggested changes.

Move files into the correct category folders based on the chosen suggestions.

Logging of moves and undo functionality.

This app will make organising files easier and not require a paid cloud AI API.

๐Ÿ› ๏ธ Technologies

Below are the technologies we used:

Python - Main logic.

Streamlit - UI.

Ollama - Local AI model.

Gemma 3 - Local AI model.

Pytest - Testing.

๐Ÿง  How does it work?

It works by:

  1. Selecting a folder.

  2. Scanning through files in the folder.

  3. Gathering useful information from files.

  4. Providing suggested categories and names from the local AI model.

  5. Reviewing the suggested changes.

  6. Applying chosen changes. With logging of moves to enable undo functionality.

The app includes a fallback for categorising files if the AI provides an invalid result.

The app uses the AI to provide suggestions and standard Python file operations to make it easy to experiment with.

๐Ÿ”“ Why Open Source AI?

One of the most interesting parts of this project was using an open weight model running locally.

I think open innovation is very important for various reasons.

1. More control over data.

Using local inference means you donโ€™t need to send any file information to an external AI. Whether this is private depends on how the app is set up.

2. Developers can play around with AI apps.

You wonโ€™t need a paid inference API to play around with an AI powered app.

3. Learn how to implement AI.

Open weight models allow you to play around with prompts and learn how to implement AI into real apps. You can also see the limitations of the model.

4. More flexibility.

Apps using a local model can potentially use different compatible models depending on your requirements.

This was a good opportunity to look into how local AI can be used to solve a small problem we can all relate to.

๐Ÿฆฅ Why Slow and Steady?

Not the most exciting thing to do but something we all do regularly.

Sloth Sorter was built keeping it simple. Automate repetitive tasks, keep the user in control and make everyday tasks easier.

I didnโ€™t want to build another chatbot so I looked into how AI can be used practically.

๐Ÿ“š What did I learn?

I learned how to:

Include a local AI model in a Python app.

Use Ollama to run the model locally.

Create an interactive UI with Streamlit.

Combine AI suggestions with deterministic file processing.

Deal with name clashes and basic file safety.

Write tests to automate the categorisation, scanning, moving and undo functionality.

Also a good reminder that you should always review AI suggestions before any changes are made to your files.

๐Ÿ”ฎ Future Improvements

I would like to improve the following:

Improve categorisation for different file types.

Improve name suggestions.

Improve the UI for reviewing changes.

Improve testing and edge cases.

More options for customising categories.

๐ŸŒŸ View the Project

View the source code here:

๐Ÿ”— GitHub Repo: https://github.com/Abhinav55849/sloth-sorter

I would love any feedback, suggestions or contributions from the open source community.

If you think the idea is useful feel free to view the code!

Top comments (0)