Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { askOpenGPT4o } from "./lib/chatgpt.js";
|
|
| 11 |
import { processImageUpscaler } from "./lib/enchance.js";
|
| 12 |
import { toAnime } from "./lib/toanime.js";
|
| 13 |
import { convertWebpToPng } from "./lib/converter.js";
|
|
|
|
| 14 |
|
| 15 |
const app = express();
|
| 16 |
app.set('json spaces', 4);
|
|
@@ -131,16 +132,22 @@ app.post('/api/toanime', async (req, res) => {
|
|
| 131 |
responseType: "arraybuffer"
|
| 132 |
})
|
| 133 |
const response = await toAnime(data_img.data);
|
| 134 |
-
const converting = await
|
| 135 |
-
const type_img = await fileTypeFromBuffer(converting)
|
| 136 |
-
res.setHeader('Content-Type', type_img.mime)
|
| 137 |
-
res.
|
|
|
|
|
|
|
|
|
|
| 138 |
} else if (images && typeof images == 'string' && isBase64(images)) {
|
| 139 |
const response = await await toAnime(Buffer.from(images, "base64"));
|
| 140 |
-
const converting = await
|
| 141 |
-
const type_img = await fileTypeFromBuffer(converting)
|
| 142 |
-
res.setHeader('Content-Type', type_img.mime)
|
| 143 |
-
res.
|
|
|
|
|
|
|
|
|
|
| 144 |
} else {
|
| 145 |
res.json({
|
| 146 |
success: false, message: 'No url or base64 detected!!'
|
|
|
|
| 11 |
import { processImageUpscaler } from "./lib/enchance.js";
|
| 12 |
import { toAnime } from "./lib/toanime.js";
|
| 13 |
import { convertWebpToPng } from "./lib/converter.js";
|
| 14 |
+
import { Upload } from "./lib/uploader.js"
|
| 15 |
|
| 16 |
const app = express();
|
| 17 |
app.set('json spaces', 4);
|
|
|
|
| 132 |
responseType: "arraybuffer"
|
| 133 |
})
|
| 134 |
const response = await toAnime(data_img.data);
|
| 135 |
+
const converting = await Upload(response[0][0].image.url)
|
| 136 |
+
//const type_img = await fileTypeFromBuffer(converting)
|
| 137 |
+
//res.setHeader('Content-Type', type_img.mime)
|
| 138 |
+
res.json({
|
| 139 |
+
status: true,
|
| 140 |
+
result: ...converting
|
| 141 |
+
})
|
| 142 |
} else if (images && typeof images == 'string' && isBase64(images)) {
|
| 143 |
const response = await await toAnime(Buffer.from(images, "base64"));
|
| 144 |
+
const converting = await Upload(response[0][0].image.url)
|
| 145 |
+
//const type_img = await fileTypeFromBuffer(converting)
|
| 146 |
+
//res.setHeader('Content-Type', type_img.mime)
|
| 147 |
+
res.json({
|
| 148 |
+
status: true,
|
| 149 |
+
result: ...converting
|
| 150 |
+
})
|
| 151 |
} else {
|
| 152 |
res.json({
|
| 153 |
success: false, message: 'No url or base64 detected!!'
|