{"id":28633573,"url":"https://github.com/trueblocks/trueblocks-dalle","last_synced_at":"2025-06-12T15:09:04.077Z","repository":{"id":291262133,"uuid":"977105866","full_name":"TrueBlocks/trueblocks-dalle","owner":"TrueBlocks","description":"A go package that creates disturbing images from Ethereum addresses or hashes","archived":false,"fork":false,"pushed_at":"2025-05-10T11:44:08.000Z","size":268,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T11:49:02.076Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TrueBlocks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-03T12:44:03.000Z","updated_at":"2025-05-10T11:44:11.000Z","dependencies_parsed_at":"2025-05-03T13:51:11.289Z","dependency_job_id":"9136d794-ea57-4151-b508-c56667ea0523","html_url":"https://github.com/TrueBlocks/trueblocks-dalle","commit_stats":null,"previous_names":["trueblocks/trueblocks-dalle"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TrueBlocks/trueblocks-dalle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueBlocks%2Ftrueblocks-dalle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueBlocks%2Ftrueblocks-dalle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueBlocks%2Ftrueblocks-dalle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueBlocks%2Ftrueblocks-dalle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TrueBlocks","download_url":"https://codeload.github.com/TrueBlocks/trueblocks-dalle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TrueBlocks%2Ftrueblocks-dalle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259490550,"owners_count":22865769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-12T15:09:03.455Z","updated_at":"2025-06-12T15:09:04.068Z","avatar_url":"https://github.com/TrueBlocks.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# trueblocks-dalle\n\n**Trueblocks Dalle** is a Go package for generating, enhancing, and annotating creative prompts and images, powering the TrueBlocks Dalledress application. It combines attribute-driven prompt generation, OpenAI integration, and image annotation in a modular, testable, and extensible design.\n\n---\n\n## 🚀 Features\n\n- **Attribute-Driven Prompt Generation:** Compose prompts from structured attributes (adjectives, nouns, styles, etc.).\n- **Template-Based Construction:** Go templates for multiple prompt formats (data, title, terse, enhanced).\n- **OpenAI Integration:** Enhance prompts with GPT-4 or DALL·E 3 via API.\n- **Image Annotation:** Overlay text on images with color/contrast analysis.\n- **Series Management:** Organize and persist sets of attributes for reproducibility.\n- **Caching:** In-memory cache for fast prompt/image retrieval.\n- **Testability:** Centralized mocks and dependency injection for robust testing.\n\n---\n\n## 🗂️ Project Structure\n\n| File/Folder     | Purpose                                     |\n| --------------- | ------------------------------------------- |\n| `attribute.go`  | Attribute struct and constructor            |\n| `dalledress.go` | DalleDress struct and prompt logic          |\n| `series.go`     | Series struct and attribute set management  |\n| `openai.go`     | OpenAI request/response types               |\n| `prompt.go`     | Prompt enhancement with OpenAI              |\n| `annotate.go`   | Image annotation utilities                  |\n| `image.go`      | Image download and processing               |\n| `database.go`   | Embedded CSV database loading and filtering |\n| `context.go`    | Context: templates, series, dbs, cache      |\n| `testing.go`    | Centralized test helpers and mocks          |\n| `ai/`           | AI-related assets                           |\n| `output/`       | Output and cache files (auto-generated)     |\n\n---\n\n## 🛠️ Setup\n\n### Prerequisites\n\n- Go 1.23+\n- [TrueBlocks Core](https://github.com/TrueBlocks/trueblocks-core)\n- [OpenAI API Key](https://platform.openai.com/account/api-keys)\n- [gg](https://github.com/fogleman/gg) and [go-colorful](https://github.com/lucasb-eyer/go-colorful) for image annotation\n\n### Getting Started\n\n```bash\ngit clone https://github.com/TrueBlocks/trueblocks-dalle.git\ncd trueblocks-dalle\ngo mod tidy\nexport OPENAI_API_KEY=sk-...yourkey...\n```\n\n---\n\n## ✨ Usage\n\n**Basic Prompt Generation:**\n\n```go\nimport \"github.com/TrueBlocks/trueblocks-dalle/v2/pkg/dalle\"\n\nctx := dalle.NewContext(\"output\")\ndd, err := ctx.MakeDalleDress(\"0x1234...\")\nif err != nil { panic(err) }\nfmt.Println(dd.Prompt)\n```\n\n**Enhance a Prompt:**\n\n```go\nresult, err := dalle.EnhancePrompt(\"A cat in a hat\", \"author\")\nfmt.Println(result)\n```\n\n**Annotate an Image:**\n\n```go\noutputPath, err := dalle.annotate(\"Hello World\", \"input.png\", \"bottom\", 0.1)\nfmt.Println(\"Annotated image saved to:\", outputPath)\n```\n\n---\n\n## 🧩 Data \u0026 Output\n\n- **Attribute Databases:** Embedded CSVs (see `embedded.go`). Add new CSVs to `databases/` and update `attribute.go` if needed.\n- **Output:** Prompts, images, and cache files are written to `output/`, organized by series and type.\n\n---\n\n## 🧪 Testing\n\nRun all tests:\n\n```bash\ngo test ./...\n```\n\n- Tests cover core logic, with mocks for file/network operations.\n- Some image annotation tests may require macOS and system fonts.\n\n---\n\n## 📝 Contributing\n\n- Open issues for bugs or features.\n- Submit PRs with clear descriptions and tests.\n- Follow Go best practices.\n\n---\n\n## 📜 License\n\nThis project is licensed under the **GNU GPL v3**. See [LICENSE](./LICENSE).\n\n---\n\n## 👩‍💻 Credits\n\n- TrueBlocks contributors\n- Thanks to [gg](https://github.com/fogleman/gg), [go-colorful](https://github.com/lucasb-eyer/go-colorful), and [OpenAI](https://openai.com/).\n\n---\n\n## 💡 Tips\n\n- Set `OPENAI_API_KEY` and (optionally) `DALLE_QUALITY`.\n- Extend attributes by adding CSVs and updating `attribute.go`.\n- Use Go’s testing/logging for debugging.\n- Caching is built-in; tune batch sizes/rate limits as needed.\n\n---\n\n## 🌈 Why trueblocks-dalle?\n\n- **Modular:** Swap templates, attributes, or models easily.\n- **Transparent:** Open, testable, and well-documented.\n- **Creative:** Designed for generative art and prompt engineering.\n\n---\n\n## 📬 Questions?\n\nOpen an issue or reach out on GitHub. Happy prompting!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrueblocks%2Ftrueblocks-dalle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrueblocks%2Ftrueblocks-dalle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrueblocks%2Ftrueblocks-dalle/lists"}