Spaces:
Runtime error
Runtime error
File size: 679 Bytes
13face0 6bcf543 ef87a58 13face0 da106cc 13face0 ef87a58 13face0 ef87a58 13face0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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,
});
}
|