This repository contains a simple Python Flask App running with the Google AI Gemini API, designed to get you started building with Gemini's multi-modal capabilities. The app comes with a basic UI and a Flask backend.

To send your first API request with the Gemini API Python SDK, make sure you have the right dependencies installed (see installation steps below) and then run the following code:
import os
import google.generativeai as genai
genai.configure(api_key = os.getenv("GEMINI_API_KEY"))
model = genai.GenerativeModel('gemini-1.5-flash')
chat = model.start_chat(history=[])
response = chat.send_message("In one sentence, explain how AI works to a child.")
print(response.text)
response = chat.send_message("Now explain it like I a Physics PhD student")
print(response.text)
-
If you don’t have Python installed, install it from Python.org.
-
Clone this repository.
-
Create a new virtual environment:
-
macOS:
$ python -m venv venv $ . venv/bin/activate
-
Windows:
> python -m venv venv > .\venv\Scripts\activate
-
Linux:
$ python -m venv venv $ source venv/bin/activate
-
-
Install the requirements:
$ pip install -r requirements.txt
-
Make a copy of the example environment variables file:
$ cp .env.example .env
-
Add your API key to the newly created
.env
file or as an environment variable. -
Run the app:
$ flask run
You should now be able to access the app from your browser at the following URL: http://localhost:5000!