get image

This commit is contained in:
zjt 2024-05-25 22:31:49 +08:00
parent 6f43190f9d
commit a32007c8fd
3 changed files with 62 additions and 47 deletions

View File

@ -20,6 +20,7 @@ const Txt23DHandler: RequestHandler<any, any> = async (ctx) => {
const { prompt, url } = requestBody;
const inputNode = selectNodeFromApiJSONbyID(txt23dApiFormatJSON, "33");
inputNode.inputs.string = prompt;
try {
ctx.body = {
url: ctx.body = baseUrl + '/view?filename=' + await new Promise((resolve, reject) => {
const taskID = Math.random().toFixed(10);
@ -52,5 +53,9 @@ const Txt23DHandler: RequestHandler<any, any> = async (ctx) => {
}
})
}
} catch (error) {
console.log(error);
}
}
export default Txt23DHandler;

View File

@ -24,6 +24,7 @@ const Txt2ImgHandler: RequestHandler<Txt2ImgRequest, any> = async (ctx, next) =>
let temp = "";
let preViewBlobs: any = [];
inputNode.inputs.string = prompt;
try {
ctx.body = {
data: await new Promise((resolve, reject) => {
const taskID = Math.random().toFixed(10);
@ -75,5 +76,9 @@ const Txt2ImgHandler: RequestHandler<Txt2ImgRequest, any> = async (ctx, next) =>
}
})
}
} catch (error) {
console.log(error);
}
}
export default Txt2ImgHandler;

View File

@ -21,6 +21,7 @@ const UpscaleHandler: RequestHandler<any ,any> = async (ctx) => {
const { prompt, url } = requestBody;
const inputNode = selectNodeFromApiJSONbyID(upScaleAPIFormatJSON, "12");
inputNode.inputs.image = url;
try {
ctx.body = {
url: baseUrl + '/view?filename=' + await new Promise((resolve, reject) => {
const taskID = Math.random().toFixed(10);
@ -52,5 +53,9 @@ const UpscaleHandler: RequestHandler<any ,any> = async (ctx) => {
}
})
}
}catch (error) {
console.log(error);
}
}
export default UpscaleHandler;