Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const axios = require('axios')
- class AdobeFirefly {
- constructor(options = {}) {
- this.options = options
- }
- generate = prompt => new Promise(async resolve => {
- try {
- const json = await (await axios.post('https://firefly.adobe.io/v2/images/generate', {
- prompt, "size": {
- "width": 2048, "height": 2048
- }, "visualIntensity": 6, "locale": "en-ID", "seeds": [61438, 95119, 42010, 42205]}, {
- headers: {
- ...this.options
- }
- })).data
- if (!json.outputs || json.outputs.length < 1) return ({
- status: false,
- msg: `Can't generate image!`
- })
- resolve({
- status: true,
- data: json.outputs
- })
- } catch (e) {
- resolve({
- status: false,
- msg: e.message
- })
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement