Spaces:
Sleeping
Sleeping
Upload 17 files
Browse files
server.js
CHANGED
|
@@ -53,7 +53,10 @@ app.get("/api/download", async (req, res) => {
|
|
| 53 |
const { file } = req.query;
|
| 54 |
if (!file) return res.status(400).json({ error: "Missing 'file' query param" });
|
| 55 |
|
| 56 |
-
const url =
|
|
|
|
|
|
|
|
|
|
| 57 |
try {
|
| 58 |
const response = await fetch(url, {
|
| 59 |
headers: { Authorization: `Bearer ${HF_TOKEN}` },
|
|
|
|
| 53 |
const { file } = req.query;
|
| 54 |
if (!file) return res.status(400).json({ error: "Missing 'file' query param" });
|
| 55 |
|
| 56 |
+
const url =
|
| 57 |
+
typeof file === "string" && file.startsWith("http")
|
| 58 |
+
? file
|
| 59 |
+
: `https://huggingface.co/datasets/${file}`;
|
| 60 |
try {
|
| 61 |
const response = await fetch(url, {
|
| 62 |
headers: { Authorization: `Bearer ${HF_TOKEN}` },
|