Spaces:
Running
Running
Julian Bilcke
commited on
Commit
Β·
7510941
1
Parent(s):
7da13d6
fix
Browse files- public/index.html +6 -6
- src/index.mts +15 -2
public/index.html
CHANGED
|
@@ -235,12 +235,12 @@
|
|
| 235 |
this.spaceUrl = detectedSpaceUrl;
|
| 236 |
this.state = "stopped";
|
| 237 |
|
| 238 |
-
// Add
|
| 239 |
-
console.log("Waiting
|
| 240 |
setTimeout(() => {
|
| 241 |
console.log("Space URL is now ready to load");
|
| 242 |
this.spaceUrlReady = true;
|
| 243 |
-
},
|
| 244 |
}
|
| 245 |
}
|
| 246 |
|
|
@@ -253,12 +253,12 @@
|
|
| 253 |
this.spaceUrl = retryDetectedSpaceUrl;
|
| 254 |
this.state = "stopped";
|
| 255 |
|
| 256 |
-
// Add
|
| 257 |
-
console.log("Waiting
|
| 258 |
setTimeout(() => {
|
| 259 |
console.log("Space URL is now ready to load");
|
| 260 |
this.spaceUrlReady = true;
|
| 261 |
-
},
|
| 262 |
}
|
| 263 |
}
|
| 264 |
|
|
|
|
| 235 |
this.spaceUrl = detectedSpaceUrl;
|
| 236 |
this.state = "stopped";
|
| 237 |
|
| 238 |
+
// Add 3-second delay before loading the space URL
|
| 239 |
+
console.log("Waiting 3 seconds before loading the space...");
|
| 240 |
setTimeout(() => {
|
| 241 |
console.log("Space URL is now ready to load");
|
| 242 |
this.spaceUrlReady = true;
|
| 243 |
+
}, 3000);
|
| 244 |
}
|
| 245 |
}
|
| 246 |
|
|
|
|
| 253 |
this.spaceUrl = retryDetectedSpaceUrl;
|
| 254 |
this.state = "stopped";
|
| 255 |
|
| 256 |
+
// Add 3-second delay before loading the space URL
|
| 257 |
+
console.log("Waiting 3 seconds before loading the space...");
|
| 258 |
setTimeout(() => {
|
| 259 |
console.log("Space URL is now ready to load");
|
| 260 |
this.spaceUrlReady = true;
|
| 261 |
+
}, 3000);
|
| 262 |
}
|
| 263 |
}
|
| 264 |
|
src/index.mts
CHANGED
|
@@ -117,10 +117,23 @@ app.get('/app', async (req, res) => {
|
|
| 117 |
|
| 118 |
// Send the space URL back to the frontend
|
| 119 |
if (spaceInfo && spaceInfo.username && spaceInfo.slug) {
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
// Add clear markers and spacing to make the space URL easier to detect
|
| 122 |
res.write(`\n\n<!-- SPACE URL MARKER -->\n<space-url>${spaceUrl}</space-url>\n<!-- END SPACE URL MARKER -->\n\n`)
|
| 123 |
-
console.log(`Created space: ${spaceUrl}`)
|
| 124 |
}
|
| 125 |
}
|
| 126 |
|
|
|
|
| 117 |
|
| 118 |
// Send the space URL back to the frontend
|
| 119 |
if (spaceInfo && spaceInfo.username && spaceInfo.slug) {
|
| 120 |
+
// Determine SDK type using the same logic as in createSpace.mts
|
| 121 |
+
let sdk;
|
| 122 |
+
if (files.some(file => file.path.includes("Dockerfile"))) {
|
| 123 |
+
sdk = "docker";
|
| 124 |
+
} else if (files.some(file => file.path.includes("app.py"))) {
|
| 125 |
+
sdk = "streamlit";
|
| 126 |
+
} else {
|
| 127 |
+
sdk = "static";
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
// Only static SDK spaces use the static.hf.space domain
|
| 131 |
+
const domain = sdk === "static" ? "static.hf.space" : "hf.space";
|
| 132 |
+
const spaceUrl = `https://${spaceInfo.username}-${spaceInfo.slug}.${domain}`
|
| 133 |
+
|
| 134 |
// Add clear markers and spacing to make the space URL easier to detect
|
| 135 |
res.write(`\n\n<!-- SPACE URL MARKER -->\n<space-url>${spaceUrl}</space-url>\n<!-- END SPACE URL MARKER -->\n\n`)
|
| 136 |
+
console.log(`Created ${sdk} space: ${spaceUrl}`)
|
| 137 |
}
|
| 138 |
}
|
| 139 |
|