Spaces:
Running
Running
Clarify unavailable model IDs
Browse files- static-app.js +1 -1
static-app.js
CHANGED
|
@@ -178,7 +178,7 @@
|
|
| 178 |
try {
|
| 179 |
const encoded = repo.split("/").map(encodeURIComponent).join("/");
|
| 180 |
const apiResponse = await fetch(`https://huggingface.co/api/models/${encoded}`);
|
| 181 |
-
if (
|
| 182 |
if (!apiResponse.ok) throw new Error("The Hub API could not be reached. Try again shortly.");
|
| 183 |
const api = await apiResponse.json();
|
| 184 |
if (api.private || api.gated) throw new Error("That model is private or gated. This version reviews public cards only.");
|
|
|
|
| 178 |
try {
|
| 179 |
const encoded = repo.split("/").map(encodeURIComponent).join("/");
|
| 180 |
const apiResponse = await fetch(`https://huggingface.co/api/models/${encoded}`);
|
| 181 |
+
if ([401, 403, 404].includes(apiResponse.status)) throw new Error("That model ID is not available as a public Hub repository. Check the ID or choose a public, ungated model.");
|
| 182 |
if (!apiResponse.ok) throw new Error("The Hub API could not be reached. Try again shortly.");
|
| 183 |
const api = await apiResponse.json();
|
| 184 |
if (api.private || api.gated) throw new Error("That model is private or gated. This version reviews public cards only.");
|