Syntharia: Cloudflare Python Workers creative AI studio#1
Draft
Syntharia: Cloudflare Python Workers creative AI studio#1
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)WorkerEntrypointsubclass with URL router, CORS preflight handling, and JSON body parsingGET /→ SPA,POST /api/art/generate,/api/art/style-transfer,/api/music/compose,/api/poetry/generate,/api/refineHandlers (
src/handlers/)art.py— text-to-image via@cf/stabilityai/stable-diffusion-xl-base-1.0; 6 style modifiers, negative prompt, clamped step countstyle_transfer.py— img2img via@cf/runwayml/stable-diffusion-v1-5-img2img; 8 presets + free-text style, base64 image input, strength clampingmusic.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 outputpoetry.py— same LLM; 6 poetic forms × 6 tones via system-prompt constraintsrefine.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 promptUI (
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.pyshims theworkersmodule so tests run outside the Cloudflare runtime —env.AI.runis anAsyncMock.pip install -r requirements-dev.txt python -m pytest tests/ -v # 35 passedWarning
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/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
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.