Spaces:
Sleeping
Sleeping
Upload 17 files
Browse files- dashboardlogic.js +5 -0
dashboardlogic.js
CHANGED
|
@@ -481,6 +481,11 @@ async function handleUpload(input) {
|
|
| 481 |
loading(true);
|
| 482 |
// Match known-working version: rely on existing connected client and pass tokens with the request
|
| 483 |
console.log('Uploading file:', file, 'type:', file.constructor.name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
const result = await client.predict("/upload_file_secure", withTokens({
|
| 485 |
user_id: currentUser,
|
| 486 |
password: currentPassword,
|
|
|
|
| 481 |
loading(true);
|
| 482 |
// Match known-working version: rely on existing connected client and pass tokens with the request
|
| 483 |
console.log('Uploading file:', file, 'type:', file.constructor.name);
|
| 484 |
+
// Ensure client is connected with HF token for private Space (token set by login as hf_server_token)
|
| 485 |
+
if (!client) {
|
| 486 |
+
const hfToken = getWriteToken() || getReadToken();
|
| 487 |
+
client = await Client.connect("pockit-cloud/main", { hf_token: hfToken });
|
| 488 |
+
}
|
| 489 |
const result = await client.predict("/upload_file_secure", withTokens({
|
| 490 |
user_id: currentUser,
|
| 491 |
password: currentPassword,
|