Spin up a full Ollama stack on Google Colab, backed by cloud GPUs, and talk to any supported open-source LLM through a clean Gradio interface.
This repository contains a Jupyter Notebook that:
- Deploys a fully functional Ollama instance on Google Colab
- Exposes an interactive Gradio web UI for chatting with models
- Lets you run and test open source LLMs on Google’s cloud GPUs
(no high end local hardware required)
-
Cloud-Based Inference
Run resource-intensive models without a powerful local machine. -
Universal Model Support
Load and use any model available in the Ollama library. -
Custom System Prompts
Inject specific instruction sets directly into the system context. -
Parameter Tuning
Adjusttemperature,top_p, andtop_kto match your use case.
- Interactive Web UI
Specialized chat interface built with Gradio, served from within Colab.
- Go to Runtime → Change runtime type.
- Set the hardware accelerator to:
- T4 GPU (free tier), or
- A100 (Colab Pro / Pro+), if available.
Note
The initial setup cell may take several minutes while it installs Linux dependencies and NVIDIA drivers.
- Execute all cells in order from top to bottom.
- When the final cell finishes:
- Locate the Gradio live link in the output.
- Click it to open your chat dashboard in a new tab.
The deployment is model agnostic: you are not restricted to a single preinstalled model. Any model exposed by Ollama’s library can be pulled and used dynamically.
- Open the generated Gradio public link after the Colab cells finish.
- In the Configuration sidebar, find the Model Name input.
- Enter the desired model tag, for example:
- llama3
- dolphin3
- mistral
- gemma:7b
- Refer to the Ollama Library for the full list of valid model tags.
- Click Pull Model.
- Wait until the status indicates “Successfully pulled”.
- Start chatting with the selected model immediately.
Environment & Stack
- Backend: Ollama (Linux
amd64bundle) - Frontend: Gradio (Python)
- Environment: Ubuntu 22.04 (standard Google Colab runtime)
- Networking: Gradio tunnel exposing the local server to the public web
This notebook runs entirely on Google Colab resources:
-
The server is active only while the Colab runtime is alive.
-
If the browser tab is closed, the runtime idles out, or the session times out:
- The Ollama instance stops.
- The Gradio link becomes invalid.
-
To resume, you must:
- Reconnect the runtime
- Rerun the notebook cells
- Reopen the new Gradio link
Use this setup as an ephemeral, GPU backed playground rather than a persistent production deployment.