This guide walks you through installing Ollama on Windows, Linux, or macOS, pulling specific large language models (LLMs), running the Ollama server, and launching a Python Flask chat application.
- A computer running Windows, Linux, or macOS.
- Python 3.6+ installed (for the Flask application).
- Basic familiarity with terminal/command line usage.
- Internet connection for downloading Ollama and models.
- Download Ollama:
- Visit ollama.com/download.
- Download the Windows executable (
ollama-windows.exe).
- Install:
- Double-click the downloaded
.exefile. - Follow the on-screen prompts to install Ollama.
- Double-click the downloaded
- Verify Installation:
- Open Command Prompt or PowerShell.
- Run
ollama --versionto check if it’s installed correctly.
- Install via Terminal:
-
Open a terminal.
-
Run the following command:
curl -fsSL https://ollama.com/install.sh | sh
-
This script downloads and installs Ollama automatically.
-
- Verify Installation:
- Run
ollama --versionto confirm it’s installed.
- Run
- Download Ollama:
- Visit ollama.com/download.
- Download the macOS application (
.dmgfile).
- Install:
- Open the
.dmgfile. - Drag the
Ollama.appto yourApplicationsfolder.
- Open the
- Verify Installation:
- Open Terminal.
- Run
ollama --versionto check the installation.
Note: Ensure Ollama is added to your system PATH (usually automatic on Windows/macOS; on Linux, you may need to restart your terminal).
Ollama allows you to download models from its library. We’ll pull the following models:
huihui_ai/deepseek-r1-abliterated:latestllama3command-r7b:latest
- Open Terminal/Command Prompt:
- Ensure Ollama is installed (from Step 1).
- Pull Models:
-
Run these commands one by one:
ollama pull huihui_ai/deepseek-r1-abliterated:latest: ollama pull llama3: ollama pull command-r7b:latest:
-
Each command downloads the specified model. The first run may take time depending on your internet speed.
-
- Verify Models:
-
List installed models with:
ollama list
-
You should see
huihui_ai/deepseek-r1-abliterated:latest,llama3:latest, andcommand-r7b:latestin the output.
-
Note: Model names are case-sensitive, and :latest is optional for llama3 and command-r7b if you want the latest version (assumed here).
Ollama must be running as a server to serve the Flask application’s API requests.
- Start the Ollama Server:
-
In a terminal or Command Prompt, run:
ollama serve
-
This starts the Ollama server at
http://127.0.0.1:11434(default). -
Keep this terminal window open while using the Flask app.
-
- Test the Server (Optional):
-
In a new terminal, run:
ollama run llama3 "Hello, world!"
-
If it responds, the server is working.
-
Note: On Windows, if ollama serve doesn’t work directly, ensure the Ollama service is running (check the system tray or Task Manager).
Here's the fully formatted version of Step 4, matching the exact style and formatting of your existing README.md:
We’ll use the prebuilt Flask application from the following GitHub repository:
🔗 https://github.com/parvghai/ollama-simple-ui
-
Open a terminal or Command Prompt and run:
git clone https://github.com/parvghai/ollama-simple-ui.git cd ollama-simple-ui
-
Ensure Python is installed:
python --version -
(Optional but recommended) Create and activate a virtual environment:
Linux/macOS:
python -m venv venv source venv/bin/activateWindows:
python -m venv venv venv\Scripts\activate
-
Run the following command inside the project directory:
pip install -r requirements.txt
-
Start the Flask server:
python app.py -
The app starts in debug mode on
http://127.0.0.1:5000by default. -
You’ll see output like:
Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
-
Open a web browser and go to:
http://127.0.0.1:5000/chat -
Use the interface to send messages, switch models (via the dropdown), and export chat history.
Note: The necessary templates (home.html and index.html) are already included in the templates folder in the cloned repository.
- Ollama Not Found: Verify it’s installed and in your PATH (
echo $PATHon Linux/macOS;PATHin Windows Command Prompt). - Model Pull Fails: Check your internet connection and Ollama server status (
ollama serverunning). - Flask Errors: Ensure all dependencies are installed and
app.pymatches the provided code. - Port Conflicts: If
11434or5000are in use, stop conflicting processes or modify the Flask app’s port (e.g.,app.run(debug=True, port=5001)).
- Changing Models: The Flask app uses
llama3by default. Switch models via the/set_modelendpoint (handled by the frontend dropdown). - Hardware: Larger models like
command-r7bmay require more RAM/GPU. Check ollama.com/library for requirements. - Stopping the Server: Press
Ctrl+Cin the terminal to stopollama serveor the Flask app.
Enjoy your local LLM-powered chat application!
- Structure: Organized into clear steps for installation, model pulling, server setup, and Flask app execution.
- Platform-Specific Instructions: Covers Windows, Linux, and macOS for Ollama installation.
- Model Pulling: Specifies the exact commands for the requested models (
huihui_ai/deepseek-r1-abliterated:latest,llama3,command-r7b:latest). - Ollama Server: Explains how to run
ollama serveand keep it active. - Flask Setup: Guides through Python setup, dependency installation, and running your
app.py, assuming it’s the code you provided. - Troubleshooting: Addresses common issues to ensure smooth setup.
This README.md should work seamlessly with your existing Flask code, JavaScript, and CSS, assuming the HTML templates (home.html and index.html) are correctly set up in a templates folder. Let me know if you need the HTML templates or further adjustments!