Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/squidmin/gemini-api-backend
Backend service for experimenting with the Gemini API
https://github.com/squidmin/gemini-api-backend
fastapi gemini gemini-api python python3
Last synced: 9 days ago
JSON representation
Backend service for experimenting with the Gemini API
- Host: GitHub
- URL: https://github.com/squidmin/gemini-api-backend
- Owner: squidmin
- Created: 2024-03-20T18:22:15.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-26T00:00:14.000Z (6 months ago)
- Last Synced: 2024-10-12T22:56:37.305Z (24 days ago)
- Topics: fastapi, gemini, gemini-api, python, python3
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gemini-api-backend
This is a backend service for experimenting with the Gemini API.
## Installation
### 1. Install Python
You can install Python using `pyenv` on macOS or Linux. On Windows, you can use `pyenv-win`.
### 2. Install dependencies
You can install the dependencies using `pip` and the `requirements.txt` file.
```shell
pip3 install -r requirements.txt
```### 3. Run the application
You can run the application using `uvicorn`.
```shell
uvicorn main:app --reload
```The `--reload` flag enables hot reloading so the server will automatically reload when you make changes to your code.
You should see output indicating that the server is running, typically on `http://127.0.0.1:8000`.### Building a Docker image
You can build the Docker image using the `Dockerfile` in the root directory.
```shell
docker build -t gemini-api-backend .
```### Running a container locally
Use the `docker run` command and pass the `gemini-api-backend` service account key as an environment variable:
```shell
docker run -p 8000:8000 \
-v /Users/admin/.config/gcloud/sa-private-key.json:/secrets/sa-private-key.json \
-e GOOGLE_APPLICATION_CREDENTIALS=/secrets/sa-private-key.json \
gemini-api-backend
```---
## Usage
You can use the backend to interact with Gemini models, execute code, and perform other tasks.