Spaces:
Running
Running
DeFactOfficial
commited on
Update image.js
Browse files
image.js
CHANGED
@@ -8,7 +8,7 @@ const { HfInference } = require("@huggingface/inference");
|
|
8 |
require("dotenv").config()
|
9 |
|
10 |
// Cache directory to store generated images
|
11 |
-
const CACHE_DIR =
|
12 |
|
13 |
|
14 |
if (!fs.existsSync(CACHE_DIR)) {
|
@@ -112,7 +112,7 @@ const generateImage = async(requestPayload, res, responseFormat) => {
|
|
112 |
// Send either the image directly or a link to the image
|
113 |
if (responseFormat == "url") {
|
114 |
res.setHeader("Content-Type", "application/json")
|
115 |
-
res.json({"image_url": "https://defactofficial-mmapi.hf.space/image_out/"+ cachePath.split("/").at(-1)})
|
116 |
res.end()
|
117 |
} else {
|
118 |
res.setHeader('Content-Type', 'application/octet-stream');
|
|
|
8 |
require("dotenv").config()
|
9 |
|
10 |
// Cache directory to store generated images
|
11 |
+
const CACHE_DIR = `${__dirname}/public/image_out`
|
12 |
|
13 |
|
14 |
if (!fs.existsSync(CACHE_DIR)) {
|
|
|
112 |
// Send either the image directly or a link to the image
|
113 |
if (responseFormat == "url") {
|
114 |
res.setHeader("Content-Type", "application/json")
|
115 |
+
res.json({"image_url": "https://defactofficial-mmapi-2.hf.space/image_out/"+ cachePath.split("/").at(-1)})
|
116 |
res.end()
|
117 |
} else {
|
118 |
res.setHeader('Content-Type', 'application/octet-stream');
|