maaf kurang rapi soalnya masih pemula :v base url : https://www.neuralframes.com/tools/image-to-prompt
const fs = require("fs")
const axios = require("axios")
const FormData = require("form-data")
async function imageToPrompt(path) {
try {
if (!fs.existsSync(path)) {
throw new Error(`File tidak ditemukan: ${path}`)
}
const form = new FormData()
form.append("file", fs.createReadStream(path))
const response = await axios.post("https://be.neuralframes.com/clip_interrogate/", form, {
headers: {
...form.getHeaders(),
"Accept": "application/json, text/plain, */*",
"Authorization": "Bearer uvcKfXuj6Ygncs6tiSJ6VXLxoapJdjQ3EEsSIt45Zm+vsl8qcLAAOrnnGWYBccx4sbEaQtCr416jxvc/zJNAlcDjLYjfHfHzPpfJ00l05h0oy7twPKzZrO4xSB+YGrmCyb/zOduHh1l9ogFPg/3aeSsz+wZYL9nlXfXdvCqDIP9bLcQMHiUKB0UCGuew2oRt",
"User-Agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36",
"Referer": "https://www.neuralframes.com/tools/image-to-prompt"
}
})
return response.data
} catch (error) {
return { error: error.message }
}
}
return imageToPrompt("./temptest.jpg")