MCPcopy Create free account
hub / github.com/ethanniser/NextFaster / generateImage

Function generateImage

scripts/makeImages.ts:11–32  ·  view source on GitHub ↗
(prompt: string)

Source from the content-addressed store, hash-verified

9import { eq } from "drizzle-orm";
10
11const generateImage = (prompt: string) =>
12 Effect.gen(function* () {
13 const res = yield* Effect.tryPromise(() =>
14 fetch("https://api.getimg.ai/v1/stable-diffusion/text-to-image", {
15 method: "POST",
16 headers: {
17 "Content-Type": "application/json",
18 Authorization: `Bearer ${process.env.GETIMG_API_KEY}`,
19 },
20 body: JSON.stringify({
21 prompt,
22 negative_prompt: "blurry",
23 width: 512,
24 height: 512,
25 response_format: "url",
26 }),
27 }),
28 );
29 const json = yield* Effect.tryPromise(() => res.json());
30 console.log(json);
31 return json;
32 });
33const uploadImage = (imageUrl: string, path: string) =>
34 Effect.gen(function* () {
35 const res = yield* Effect.tryPromise(() => fetch(imageUrl));

Callers 1

makeImages.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected