A FastAPI service for generating fashion outfit images using Ollama based on users preferences ingested via Apache Airflow for data processing.
Before getting started, ensure you have:
- Docker & Docker Compose
- Python 3.14+
- Ollama - Running with the
x/flux2-klein:4bmodel pulled
fastapi-test/
├── app/ # FastAPI application
│ ├── main.py # App entry point
│ ├── models.py # SQLAlchemy ORM models
│ ├── api/
│ │ └── routers/
│ │ ├── users.py # User endpoints
│ │ └── generate_images.py # Image generation endpoints
│ └── core/
│ ├── config.py # App config
│ ├── db.py # PostgreSQL db setup
│ └── __init__.py
├── dags/ # Apache Airflow DAGs
│ ├── create_staging_tables.py
│ └── files/
│ └── gen_fake_outfit_profiles.py # Test data generator
├── docker-compose.yaml
├── Dockerfile
├── requirements.txt
└── README.md
git clone https://github.com/Nico769/mir-challenge.git
cd fastapi-test
cp env.sample .envEdit .env with your local settings.
Follow this guide for setting up Airflow through Docker in local
- Make sure Airflow is running and go to Airflow UI → Admin → Connections
- Create new connection:
- Connection ID:
postgres_default - Connection Type: PostgreSQL
- Host:
postgres - Database:
airflow - Login/Password:
airflow
- Connection ID:
- Test & Save
python dags/files/gen_fake_outfit_profiles.pyConnect to PostgreSQL and add users matching user_outfit_profiles table IDs:
docker compose exec postgres psql -U admin -d airflow -c \
"INSERT INTO users (id) VALUES (1);"- In Airflow UI, locate
process_user_outfit_profilesDAG - Click play icon to trigger it
- Monitor execution in the DAG details view
docker compose up --build- Make sure Ollama is running
- Go to
http://localhost:8080/docsto access FastAPI Swagger UI.
See LICENSE for details.