Upload photo (binary file) direct to OpenAi classification

warning - makes use of non-bubble upload from raw html in javascript widget
AND
makes use of non bubble server ( wrapper → OpenAi.api )

Use case - prototype bubble client to upload an image from the camera and get it directly to OpenAi to classify the photo type in the context of an app to allow “point and shoot” pothole reporting using an open source model, trained on OpenAi to distguish the following image / issue types :

garbage
murals
homeless camp
graffiti

Code - note its just barebones client in bubble paired with nodeJS route that passes a photo on to a single api endpoint at OpenAi.

Background in 2 other posts and context on the idea that bubble could do more to allow easy http posts of photos and one solution is to put the JS for a fetch-post on the image directly into a native html widget that calls a block of Native javascript for the upload.

JS-for-fetch

need-better-uploads

Discussion - openai is moving very quickly with api’s and compelling features like Categorization of random photos. They offer standard api integration but, in my case, I chose NOT to implement it within bubble’s normal connection/ API tools due to the following :

i dont need DB or app state of any kind
simple prototype for upload image and Classification

The new feature is automatically issue-type various reports initiated with a simple photo POST operation.