DEV Community

Ikshita Rajput
Ikshita Rajput

Posted on

Building for a Friend: A Local LLM Sentiment Analyzer

What I Built

I built a local LLM sentiment analyzer for a friend who needed a simple way to go through a large amount of feedback without having to manually read and categorize everything.

The idea was pretty straightforward: upload a CSV containing text such as customer reviews, select the column containing the text, and let the application analyze it for sentiment.

The part I wanted to focus on was keeping the data local. Instead of sending potentially private reviews or feedback to an external AI API, the analysis runs on the user's own machine.

The basic flow is:

Upload CSV → Select text column → Run analysis → View results → Filter/export results

Code

The complete project is available on GitHub:

How I Built It

The application is built with Python and Streamlit.

For the AI part, I used Ollama to run an open-weight Llama 3.2 model locally. The application uses Scikit-LLM and scikit-ollama to connect the analysis pipeline to the local Ollama server.

The basic architecture is:

CSV
↓
Streamlit
↓
Scikit-LLM
↓
scikit-ollama
↓
Ollama
↓
Llama 3.2
↓
Sentiment / Classification Results

The default model is llama3.2:3b, and the application also supports the smaller llama3.2:1b model.

Besides sentiment analysis, I added things that make the tool more useful in practice, such as custom classification labels, optional explanations, filtering, data-quality checks, analysis history using SQLite, and exporting the results.

Why Does Open Innovation Matter?

This was probably the most important reason I wanted to build this using a local model.

When dealing with someone's reviews, feedback, or other text data, sending everything to a third-party AI API isn't always ideal. With Ollama, the model can run locally, so the data doesn't need to leave the user's computer just to get an AI-generated result.

It also means there isn't an API bill for every analysis and the application doesn't depend on a single closed AI provider.

Another thing I liked about using an open approach is that the model isn't locked into the application. I can change the model that Ollama runs without having to redesign the whole project.

For this project, open AI wasn't just something I added to satisfy the challenge. Running the model locally is what makes the privacy aspect of the project possible in the first place.

Top comments (0)