wolfyflutter

imagepromptguru.net [ai] [image to text]

Jun 7th, 2025 (edited)
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.34 KB | Source Code | 0 0
  1. /*
  2.     base : https://imagepromptguru.net/
  3.     last update : 28 Mei 2025, 23:14
  4.     by : wolep
  5.     note : join nb grup di wa. link : https://chat.whatsapp.com/LrPyjckzngeFW7uforcxRL
  6.            tell me if something broke lol :v
  7. */
  8.  
  9. const imagepromptguru = async (buffer, options = {}) => {
  10.     const image = "data:image/jpeg;base64," + buffer.toString("base64")
  11.     const { model = "general", language = "en" } = options
  12.     const headers = {
  13.         'content-type': 'application/json',
  14.         'origin': 'https://imagepromptguru.net',
  15.         'referer': 'https://imagepromptguru.net/',
  16.     }
  17.     const body = JSON.stringify({ model, language, image })
  18.  
  19.     const response = await fetch('https://api.imagepromptguru.net/image-to-prompt', {
  20.         method: 'POST', headers, body
  21.     })
  22.  
  23.     if (!response.ok) throw Error (`terjadi kesalahan. ${response.status} ${response.statusText}`)
  24.  
  25.     return await response.json()
  26. }
  27.  
  28. // cara pakai
  29. // const buff = require("fs").readFileSync("./ini_buktinya.png")
  30.  
  31. imagepromptguru(buff)
  32.     .then(console.log)
  33.     .catch(err => console.log(err.message))
  34.  
  35. /* kalian juga bisa lampirkan objek di param kedua,
  36. {
  37.     model : (general, midjourney, dalle, stable_diffusion, flux) default: general
  38.     language : (en, es, zh, zh-TW, fr, de, ja, ru, pt, ar, ko, it, nl, tr, pl, vi, th, hi, id) default: en
  39. }
  40. */
Tags: ai
Add Comment
Please, Sign In to add comment