zeke / aimg

🧑‍🎨 A Node.js CLI for generating AI images with Replicate and saving them to disk.
19 stars 0 forks source link

Installing and running on Mac #1

Closed martinkoss closed 3 months ago

martinkoss commented 3 months ago

Gosh this looks amazing but on my Mac I am not having any joy at all. Installation went ok and I got an API, adding that seemed to go ok too. But running aimg just results in errors in terminal. Not sure if this means anything but here's the error:

ReferenceError: TransformStream is not defined at Object. (/usr/local/lib/node_modules/aimg/node_modules/replicate/vendor/eventsource-parser/stream.js:182:45) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at Object. (/usr/local/lib/node_modules/aimg/node_modules/replicate/lib/stream.js:7:5) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) MK-MacBook-Pro:AI mk$

zeke commented 3 months ago

Can you share the code you're running, the Node.js version you're running, and your system info?

martinkoss commented 3 months ago

Not sure what system info you need but this is what I get when I try to generate an image:

I don’t get an image.

Martins-MacBook-Pro:flux-images martin$ aimg "elderly man" { count: 3, model: 'black-forest-labs/flux-schnell', prompt: 'elderly man', subject: undefined, outputDir: '.' } Generating images... (node:5092) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created) ApiError: Request to https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions failed with status 401 Unauthorized: {"title":"Unauthenticated","detail":"You did not pass an authentication token","status":401} . at Replicate.request (/usr/local/lib/node_modules/aimg/node_modules/replicate/index.js:266:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Replicate.createPrediction (/usr/local/lib/node_modules/aimg/node_modules/replicate/lib/predictions.js:43:16) at async Replicate.run (/usr/local/lib/node_modules/aimg/node_modules/replicate/index.js:145:20) at async run (file:///usr/local/lib/node_modules/aimg/lib/run.js:17:14) { request: Request { method: 'POST', url: 'https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions', headers: Headers { 'Content-Type': 'application/json', 'User-Agent': 'replicate-javascript/0.30.2' }, destination: '', referrer: 'about:client', referrerPolicy: '', mode: 'cors', credentials: 'same-origin', cache: 'default', redirect: 'follow', integrity: '', keepalive: false, isReloadNavigation: false, isHistoryNavigation: false, signal: AbortSignal { aborted: false } }, response: Response { status: 401, statusText: 'Unauthorized', headers: Headers { date: 'Thu, 08 Aug 2024 19:58:20 GMT', 'content-type': 'application/problem+json', 'content-length': '93', connection: 'keep-alive', 'cf-cache-status': 'DYNAMIC', 'report-to': '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=Sj7ABbhxWOWK5dIvWKZ2M29yDmGS4L%2F1d5UPlzSzW0Q7koRUivA4%2B3HgYqVMy5dWrzKiHuNUJ12EkmaBNOclGQD6mRtRCupRZW8Yw1IXBXMwuXtFZlOmdLoWqYqI8JHQkz76"}],"group":"cf-nel","max_age":604800}', nel: '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}', 'strict-transport-security': 'max-age=15552000', server: 'cloudflare', 'cf-ray': '8b02149efd53531c-LHR', 'alt-svc': 'h3=":443"; ma=86400' }, body: ReadableStream { locked: true, state: 'closed', supportsBYOB: true }, bodyUsed: true, ok: false, redirected: false, type: 'basic', url: 'https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions' } } ApiError: Request to https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions failed with status 401 Unauthorized: {"title":"Unauthenticated","detail":"You did not pass an authentication token","status":401} . at Replicate.request (/usr/local/lib/node_modules/aimg/node_modules/replicate/index.js:266:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Replicate.createPrediction (/usr/local/lib/node_modules/aimg/node_modules/replicate/lib/predictions.js:43:16) at async Replicate.run (/usr/local/lib/node_modules/aimg/node_modules/replicate/index.js:145:20) at async run (file:///usr/local/lib/node_modules/aimg/lib/run.js:17:14) { request: Request { method: 'POST', url: 'https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions', headers: Headers { 'Content-Type': 'application/json', 'User-Agent': 'replicate-javascript/0.30.2' }, destination: '', referrer: 'about:client', referrerPolicy: '', mode: 'cors', credentials: 'same-origin', cache: 'default', redirect: 'follow', integrity: '', keepalive: false, isReloadNavigation: false, isHistoryNavigation: false, signal: AbortSignal { aborted: false } }, response: Response { status: 401, statusText: 'Unauthorized', headers: Headers { date: 'Thu, 08 Aug 2024 19:58:20 GMT', 'content-type': 'application/problem+json', 'content-length': '93', connection: 'keep-alive', 'cf-cache-status': 'DYNAMIC', 'report-to': '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=rafcmLt306B8lMcWwI2JID2BxOLRcaNvRN3ZF2Tae9aoRCDu2kyMwSi3z2%2BNNd5e%2FuHZLFCCaZAlbXYziuh9VvVVNvwyGT0I2pKbDwht9E0A4gj3wYBsiGMD2Y8GBPJ2qzlh"}],"group":"cf-nel","max_age":604800}', nel: '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}', 'strict-transport-security': 'max-age=15552000', server: 'cloudflare', 'cf-ray': '8b02149eea5a9401-LHR', 'alt-svc': 'h3=":443"; ma=86400' }, body: ReadableStream { locked: true, state: 'closed', supportsBYOB: true }, bodyUsed: true, ok: false, redirected: false, type: 'basic', url: 'https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions' } } ApiError: Request to https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions failed with status 401 Unauthorized: {"title":"Unauthenticated","detail":"You did not pass an authentication token","status":401} . at Replicate.request (/usr/local/lib/node_modules/aimg/node_modules/replicate/index.js:266:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Replicate.createPrediction (/usr/local/lib/node_modules/aimg/node_modules/replicate/lib/predictions.js:43:16) at async Replicate.run (/usr/local/lib/node_modules/aimg/node_modules/replicate/index.js:145:20) at async run (file:///usr/local/lib/node_modules/aimg/lib/run.js:17:14) { request: Request { method: 'POST', url: 'https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions', headers: Headers { 'Content-Type': 'application/json', 'User-Agent': 'replicate-javascript/0.30.2' }, destination: '', referrer: 'about:client', referrerPolicy: '', mode: 'cors', credentials: 'same-origin', cache: 'default', redirect: 'follow', integrity: '', keepalive: false, isReloadNavigation: false, isHistoryNavigation: false, signal: AbortSignal { aborted: false } }, response: Response { status: 401, statusText: 'Unauthorized', headers: Headers { date: 'Thu, 08 Aug 2024 19:58:20 GMT', 'content-type': 'application/problem+json', 'content-length': '93', connection: 'keep-alive', 'cf-cache-status': 'DYNAMIC', 'report-to': '{"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=VOL584%2Bt8DLVxs37XgEC9H2rNCEzathRm3ztttjtq3eB9txSdf7LKA4tYh9NACT47Wgm%2BrIzzXdPgfHSEWYA%2BwIrhwJwnnpcwM1Yx8XDtJTgDnV8j7BtrtN%2B7hFSKb6dz42G"}],"group":"cf-nel","max_age":604800}', nel: '{"success_fraction":0,"report_to":"cf-nel","max_age":604800}', 'strict-transport-security': 'max-age=15552000', server: 'cloudflare', 'cf-ray': '8b02149f099e385b-LHR', 'alt-svc': 'h3=":443"; ma=86400' }, body: ReadableStream { locked: true, state: 'closed', supportsBYOB: true }, bodyUsed: true, ok: false, redirected: false, type: 'basic', url: 'https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions' } }

Regards

Martin Koss

inLouth by 28 Pixels Ltd https://inlouth.co.uk https://inlouth.co.uk/

28 Pixels Ltd Make Your Website a Winning Website

07942-374088 :: https://28px.uk https://28px.uk/ :: Terms and Conditions https://28px.uk/terms/

70 Spire View Road, Louth, Lincolnshire LN11 8SL Company no: 13963547 :: VAT Reg: 411 6586 08

The sending, delivery and reading of this email in no way constitute acceptance of an agreement or contract unless clearly & specifically stated to the contrary. The content of this email is confidential and intended for the specified recipient only. It is strictly forbidden to share any part of this message with any third party without the written consent of the sender.

On 8 Aug 2024, at 17:50, Zeke Sikelianos @.***> wrote:

Can you share the code you're running, the Node.js version you're running, and your system info?

— Reply to this email directly, view it on GitHub https://github.com/zeke/aimg/issues/1#issuecomment-2276257091, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHF2VPK6XZPWMFPMEBMYYDZQOOUJAVCNFSM6AAAAABMGXW7UGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZWGI2TOMBZGE. You are receiving this because you authored the thread.

zeke commented 3 months ago

You need to set an API token in your environment.

See https://github.com/zeke/aimg?tab=readme-ov-file#installation

martinkoss commented 3 months ago

Thank you.

How did I miss that?

Although it creates images, I still get this error:

(node:8039) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. (Use node --trace-deprecation ... to show where the warning was created)

Regards

Martin Koss

inLouth by 28 Pixels Ltd https://inlouth.co.uk https://inlouth.co.uk/

28 Pixels Ltd Make Your Website a Winning Website

07942-374088 :: https://28px.uk https://28px.uk/ :: Terms and Conditions https://28px.uk/terms/

70 Spire View Road, Louth, Lincolnshire LN11 8SL Company no: 13963547 :: VAT Reg: 411 6586 08

The sending, delivery and reading of this email in no way constitute acceptance of an agreement or contract unless clearly & specifically stated to the contrary. The content of this email is confidential and intended for the specified recipient only. It is strictly forbidden to share any part of this message with any third party without the written consent of the sender.

On 8 Aug 2024, at 21:20, Zeke Sikelianos @.***> wrote:

You need to set an API token in your environment.

See https://github.com/zeke/aimg?tab=readme-ov-file#installation

— Reply to this email directly, view it on GitHub https://github.com/zeke/aimg/issues/1#issuecomment-2276586790, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHF2VLV2Z3YHXKTEL37BFLZQPHIVAVCNFSM6AAAAABMGXW7UGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZWGU4DMNZZGA. You are receiving this because you authored the thread.

Akash221095 commented 2 months ago
Screenshot 2024-08-23 at 12 14 54 AM

im having this type of problem here can you help me with it thank you