Simple windowed desktop app that uses a Gemini-like API to generate images from a user prompt and display them with a "Save as PNG" option. The UI uses a dark theme and scales the displayed image to the window.
Prerequisites
- Python 3.11+
- Install dependencies from
requirements.txt(see below) - Optionally set
GEMINI_API_KEYandGEMINI_ENDPOINTenvironment variables for a real API.
Install
Open PowerShell and run:
python -m pip install -r requirements.txtRunning
To run the app:
# From the project folder
python main.pyEnvironment variables (optional)
GEMINI_API_KEY: Your API key (if omitted, the app shows a placeholder image locally).GEMINI_ENDPOINT: The image generation endpoint (defaults to a placeholder URL inapi.py).
PowerShell example to set the key for the session:
$env:GEMINI_API_KEY = "YOUR_KEY_HERE"
python main.pyNotes for integrating a real Gemini endpoint
The api.generate_image function shows how to send a JSON payload with a prompt field and handles two common response shapes:
image_base64(base64 string containing image bytes) orimage_url(URL pointing to the generated image)
Adjust api.py to match the exact Gemini request and response format your account expects.
Files
main.py— app entrygui.py— Qt UI and threadingapi.py— Gemini adapter + placeholder image generatorrequirements.txt— dependencies