Spaces:
Paused
Paused
import fetch from "node-fetch"; | |
import * as config from '.config.js' | |
async function schellwithflux(args) { | |
const API_URL = "https://api-inference.huggingface.co/models/black-forest-labs/FLUX.1-schnell"; | |
try { | |
const response = await fetch(API_URL, { | |
method: "POST", | |
headers: { | |
"Authorization": `Bearer ${config.HUGGING_TOKEN}`, | |
"Content-Type": "application/json", | |
}, | |
body: JSON.stringify({ inputs: args }), | |
}); | |
if (!response.ok) { | |
console.error(`API Error: ${response.status}`); | |
return null; | |
} | |
return await response.buffer(); | |
} catch (error) { | |
console.error("Error fetching data:", error.message); | |
return null; | |
} | |
} |