Skip to content

MdRimon29/grace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grace AI Design API

A FastAPI backend for AI-powered image editing, logo generation, and campaign asset creation using Google Gemini image models.

Python License

What this project does

Grace exposes a lightweight REST API that transforms text prompts and image uploads into edited or generated graphics.

Key capabilities:

  • edit a selected region in a base image using a prompt and optional mask
  • generate logo concepts from a prompt and optional reference image
  • produce cohesive campaign image sets as a downloadable ZIP
  • automatically save output assets to artifacts/ and serve them from /images

Why this project is useful

This API is useful for designers, marketing teams, and developers who want to prototype visual content quickly.

It is especially helpful when you need:

  • rapid image editing with targeted prompts
  • quick logo generation from brand descriptions
  • batch generation of campaign visuals with consistent style
  • an easily deployable backend for AI-assisted creative workflows

Getting started

Prerequisites

  • Python 3.11 or newer
  • A Google Gemini API key
  • Git clone of this repository

Install dependencies

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

Configure environment

Copy example.env to .env and update the value:

copy example.env .env

Then open .env and set:

GEMINI_API_KEY=YOUR_API_KEY_HERE

Run the API server

python -m uvicorn main:app --reload

The service will be available at http://127.0.0.1:8000.

Main endpoints

Health check

GET /health

Returns a simple service status response.

Edit image region

POST /edit/area

Form fields:

  • prompt (string, required)
  • base_image (file, required)
  • mask_image (file, optional)

Example curl:

curl -X POST http://127.0.0.1:8000/edit/area \
  -F "prompt=Change the logo color to gold and sharpen the text" \
  -F "base_image=@input.png" \
  -F "mask_image=@mask.png"

Generate a logo

POST /logo/generate

Form fields:

  • prompt (string, required)
  • reference_image (file, optional)

Example curl:

curl -X POST http://127.0.0.1:8000/logo/generate \
  -F "prompt=Minimalist technology brand logo for a premium SaaS product" \
  -F "reference_image=@style.png"

Generate campaign images

POST /campaign/generate

Form fields:

  • prompt (string, required)
  • brand_image (file, optional)
  • count (integer, optional, default 30)

Example curl:

curl -X POST http://127.0.0.1:8000/campaign/generate \
  -F "prompt=Bold social media campaign for a modern coffee brand" \
  -F "brand_image=@brand.png" \
  -F "count=10" --output campaign.zip

Project structure

  • main.py — FastAPI app and middleware setup
  • config.py — environment configuration loader
  • routers/ — route handlers for editing, logo, and campaign features
  • services/gemini.py — Google Gemini client integration and image generation logic
  • instruction.py — instruction prompts used by the AI model
  • artifacts/ — generated image and ZIP output storage
  • requirements.txt — Python dependencies
  • example.env — environment variable template

Help and support

If you need help:

  • open an issue in this repository
  • inspect the source code in routers/ and services/
  • review example.env for configuration guidance

Contributing

Contributions are welcome through issues and pull requests.

Please keep changes focused on usability, API stability, and compatibility with the Gemini image generation workflow.

License

This project is licensed under the terms in LICENSE.

About

An asynchronous FastAPI orchestrator for multimodal Gemini workflows, providing scalable RESTful endpoints for regional inpainting, logo synthesis, and high-throughput generative asset pipelines.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages