const axios = require('axios'); async function wainsfwillustrious(prompt, options = {}) { try { const { model = 'v140', quality_prompt = 'masterpiece, best quality, fine details', negative_prompt = 'lowres, bad anatomy, bad hands, text, error, missing finger, extra digits, fewer digits, cropped, worst quality, low quality, low score, bad score, average score, signature, watermark, username, blurry', width = 1024, height = 1024, guidance_scale = 6, numInference_steps = 30, generations = 1 } = options; const _model = ['v140', 'v130', 'v120']; if (!prompt) throw new Error('Prompt is required'); if (!_model.includes(model)) throw new Error(`Available models: ${_model.join(', ')}`); const session_hash = Math.random().toString(36).substring(2); const d = await axios.post(`https://nech-c-wainsfwillustrious-v140.hf.space/gradio_api/queue/join?`, { data: [ model, prompt, quality_prompt, negative_prompt, 0, true, width, height, guidance_scale, numInference_steps, generations, null, true ], event_data: null, fn_index: 9, trigger_id: 18, session_hash: session_hash }); const { data } = await axios.get(`https://nech-c-wainsfwillustrious-v140.hf.space/gradio_api/queue/data?session_hash=${session_hash}`); let result; const lines = data.split('\n\n'); for (const line of lines) { if (line.startsWith('data:')) { const d = JSON.parse(line.substring(6)); if (d.msg === 'process_completed') result = d.output.data[0].url; } } return result; } catch (error) { throw new Error(error.message); } } // Usage: const resp = await wainsfwillustrious('Shiroko (Blue Archive), Take a Bath'); console.log(resp);