import axios from "axios"; type Body = { style: string; pic: string; }; const HF_TOKEN = process.env.HF_TOKEN; export async function POST(req: Request) { const body = (await req.json()) as Body; const image = await axios .request({ method: "post", maxBodyLength: Infinity, url: "https://sologenius-gen-ai.hf.space/style", headers: { "Content-Type": "application/json", Authorization: `Bearer ${HF_TOKEN}`, }, data: JSON.stringify({ style: body.style, pic: body.pic, }), }) .then((response) => response.data.data); return Response.json({ message: "success", image, }); }