Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sirbuig/host-gemini-ai
Short and fast tutorial on how to host Gemini 1.5 Pro on a local environment without an API key.
https://github.com/sirbuig/host-gemini-ai
debian gemini gemini-ai os-linux tutorial ubuntu vertex-ai
Last synced: 10 days ago
JSON representation
Short and fast tutorial on how to host Gemini 1.5 Pro on a local environment without an API key.
- Host: GitHub
- URL: https://github.com/sirbuig/host-gemini-ai
- Owner: sirbuig
- License: mit
- Created: 2024-04-15T20:37:14.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-07T09:34:52.000Z (5 months ago)
- Last Synced: 2024-07-07T10:46:08.282Z (5 months ago)
- Topics: debian, gemini, gemini-ai, os-linux, tutorial, ubuntu, vertex-ai
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# How to host Gemini AI on a local environment
[![Python >= 3.8](https://img.shields.io/badge/Python->=3.8-blue.svg)](https://www.python.org/downloads/)
[![Linux](https://img.shields.io/badge/OS-Linux-blue.svg)](https://www.kernel.org/)
![Debian 9+](https://img.shields.io/badge/Debian-9%2B-red)
![Ubuntu 18.04+](https://img.shields.io/badge/Ubuntu-18.04%2B-orange)
![Gemini](https://img.shields.io/badge/Gemini-1.5%20Pro-8E75B2)
This is a super fast tutorial on how to host Gemini AI on a local environment. This guide is mostly for users from EU who don't have (yet) access to the Gemini API.
Although the tutorials from Google are far more comprehensive, for a newbie they can be quite overwhelming so this contains only the bare minimum to experiment with the Gemini models.
Even if the links provided will perhaps be useful, for more elaborate projects I advise you to follow another guide.
> [!WARNING]
> These steps were tested on Ubuntu 22.04 LTS and Linux Mint 21.3 "Virginia".
> If you have a different OS (not Debian-based) or a different version you can still follow the tutorial, however you will have to check the links/ search for alternatives. The steps remain the same.
## I - Vertex AI
Using [Google Cloud Computing Service](https://cloud.google.com/?hl=en) connect to the _Free Trial_, then **Try Gemini 1.5 Pro**. You will be redirected to **Vertex AI**.
Create a new project (remember the name) and experiment with the models and settings.
## II - [Virtualenv](https://cloud.google.com/python/docs/reference/aiplatform/latest/index.html)
Clone this repo and open the terminal.
```shell
pip install virtualenv
virtualenv
source /bin/activate
python3 -m pip install -r requirements.txt
```> [!NOTE]
> If you encounter `Command 'virtualenv' not found`, use `sudo apt install python3-virtualenv` instead.
## III - [Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev)
Install the [gcloud CLI](https://cloud.google.com/sdk/docs/install#deb).
For a faster setup use the script.
> [!NOTE]
> If you do not have the same OS or you have a different version of it, please follow the guide from the link provided adjusted to your case!```shell
chmod +x script.sh
./script.sh
```You will be redirected to a login screen, then asked to choose the project (see Step I). Follow the steps accordingly.
If succesful, you will be redirected to this [page](https://cloud.google.com/sdk/auth_success).
Now create your credential file using
`gcloud auth application-default login`.If succesful, you should see the same [page](https://cloud.google.com/sdk/auth_success) again.
## IV - [Google Cloud console](https://cloud.google.com/storage/docs/discover-object-storage-console)
For enabling PDF prompts and analysis, the object must be uploaded in a Bucket. Follow the steps accordingly.
## V - Have fun!
Modify `main.py` to your liking and enjoy the newest Gemini model!
Don't forget `python3 main.py` to run it.
> [!TIP]
> If you have any suggestions or you want to add explanations/ commands or you faced some errors I did not, you are free to contribute!
>
> This is a quick guide I made in the middle of the night after some hours spent figuring out how I can use Gemini locally.