Skip to content

Syntharia: Cloudflare Python Workers creative AI studio#1

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-cloudflare-ai-integration
Draft

Syntharia: Cloudflare Python Workers creative AI studio#1
Copilot wants to merge 3 commits intomainfrom
copilot/add-cloudflare-ai-integration

Conversation

Copy link

Copilot AI commented Mar 8, 2026

Implements the full Syntharia application from scratch — a creative AI studio running as a Cloudflare Python Worker with Workers AI bindings for image generation, music composition, poetry, style transfer, and iterative refinement.

Worker entry & routing (src/entry.py)

  • WorkerEntrypoint subclass with URL router, CORS preflight handling, and JSON body parsing
  • Routes: GET / → SPA, POST /api/art/generate, /api/art/style-transfer, /api/music/compose, /api/poetry/generate, /api/refine

Handlers (src/handlers/)

  • art.py — text-to-image via @cf/stabilityai/stable-diffusion-xl-base-1.0; 6 style modifiers, negative prompt, clamped step count
  • style_transfer.py — img2img via @cf/runwayml/stable-diffusion-v1-5-img2img; 8 presets + free-text style, base64 image input, strength clamping
  • music.py — LLM (@cf/meta/llama-3.1-8b-instruct) prompted to emit structured JSON: ABC notation, chord progression, tempo, key, style notes; 6 genre guides in system prompt; graceful fallback on non-JSON output
  • poetry.py — same LLM; 6 poetic forms × 6 tones via system-prompt constraints
  • refine.py — dispatches to the appropriate handler after augmenting the original prompt/content with the refinement instruction; for art-with-image uses style transfer, otherwise re-generates with LLM-rewritten prompt

UI (src/ui.py)

Inline dark-theme SPA returned from GET /; no static assets binding needed. Tabbed interface for all five features. Music tab renders ABC notation live via abcjs. "Refine this" buttons pre-populate the Refine tab from session state.

Configuration (wrangler.jsonc)

{
  "main": "src/entry.py",
  "compatibility_flags": ["python_workers"],
  "ai": { "binding": "AI" }
}

Tests (tests/)

35 pytest unit tests covering all handlers and routing. conftest.py shims the workers module so tests run outside the Cloudflare runtime — env.AI.run is an AsyncMock.

pip install -r requirements-dev.txt
python -m pytest tests/ -v
# 35 passed

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • developers.cloudflare.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

A creative AI studio where users collaborate with models to generate art, music, and poetry. Provides tools for image generation, music composition, style transfer, and iterative refinement. Designed as an interactive environment for exploring generative creativity and building multimedia AI-assisted projects. make it cloudflare python workers based interfacing with their cloudflare AI as well


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 8, 2026 23:09
Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
Co-authored-by: A1L13N <193832434+A1L13N@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Cloudflare AI integration for creative studio Syntharia: Cloudflare Python Workers creative AI studio Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants