Spaces:
Paused
Paused
Update index.html
Browse files- index.html +13 -4
index.html
CHANGED
|
@@ -401,20 +401,29 @@
|
|
| 401 |
image: handle_file(currentFile),
|
| 402 |
prompt,
|
| 403 |
});
|
|
|
|
|
|
|
| 404 |
const data = res.data[0];
|
|
|
|
| 405 |
|
| 406 |
-
if (data.error) {
|
| 407 |
empty.hidden = false;
|
| 408 |
empty.textContent = data.error;
|
| 409 |
-
} else {
|
| 410 |
-
|
|
|
|
|
|
|
| 411 |
result.hidden = false;
|
| 412 |
-
download.href =
|
| 413 |
download.setAttribute('download', 'edited.png');
|
| 414 |
download.hidden = false;
|
| 415 |
seedEl.textContent = `seed ${data.seed}`;
|
|
|
|
|
|
|
|
|
|
| 416 |
}
|
| 417 |
} catch (err) {
|
|
|
|
| 418 |
empty.hidden = false;
|
| 419 |
empty.textContent = 'Error: ' + (err?.message || err);
|
| 420 |
} finally {
|
|
|
|
| 401 |
image: handle_file(currentFile),
|
| 402 |
prompt,
|
| 403 |
});
|
| 404 |
+
console.log('[predict] full res:', res);
|
| 405 |
+
console.log('[predict] res.data:', res.data);
|
| 406 |
const data = res.data[0];
|
| 407 |
+
console.log('[predict] data[0]:', data);
|
| 408 |
|
| 409 |
+
if (data && data.error) {
|
| 410 |
empty.hidden = false;
|
| 411 |
empty.textContent = data.error;
|
| 412 |
+
} else if (data && data.image) {
|
| 413 |
+
const url = data.image.url || data.image.path;
|
| 414 |
+
console.log('[predict] resolved image url:', url);
|
| 415 |
+
result.src = url;
|
| 416 |
result.hidden = false;
|
| 417 |
+
download.href = url;
|
| 418 |
download.setAttribute('download', 'edited.png');
|
| 419 |
download.hidden = false;
|
| 420 |
seedEl.textContent = `seed ${data.seed}`;
|
| 421 |
+
} else {
|
| 422 |
+
empty.hidden = false;
|
| 423 |
+
empty.textContent = 'Unexpected response shape (see console)';
|
| 424 |
}
|
| 425 |
} catch (err) {
|
| 426 |
+
console.error('[predict] error:', err);
|
| 427 |
empty.hidden = false;
|
| 428 |
empty.textContent = 'Error: ' + (err?.message || err);
|
| 429 |
} finally {
|