[sharing] chatGPT n4m example

tmhglnd's icon

Hey all! I'm was experimenting a bit with chatGPT within Max. To document my results I created this little example patcher that demonstrates how to use the API with node.script. You can download the latest version from github. You do need an API Key from OpenAI for this to work. You can find it if you login to openai, click on your account and click View API Keys, then "create new secret key". Hope you find this useful!

MakePatchesNotWar's icon

Awesome, thanks for sharing! Will definitely check this out

Sabina's icon

Hello Timo,

Thank you for sharing;

Any idea about how to use this idea for DELL-E , image generation using Jitter ?

tmhglnd's icon

@Sabina, I haven't tried it myself, but I see there are some API options in the documentation: https://platform.openai.com/docs/guides/images/usage

I think you'll need to figure out some way then to get the response.data[0].url to a jitter matrix/texture. Possibly through a fs.writeFile() and then (read) it in jit.gl.texture . Maybe there are some other options to include some NDI/Syphon library in the js code so you can stream the result directly in Jitter.

If you want to use some Jitter image as input I think you'll have to find some way to use NDI/Syphon to convert the texture to a JS buffer and include it in the code const buffer = [your image data]; (as I understand it from the examples in the API).

I found this library that could be helpful converting NDI to a buffer in JS https://github.com/Streampunk/grandiose

Robert Ramirez's icon