Spaces:
Sleeping
Sleeping
Upload 17 files
Browse files- dashboardlogic.js +8 -2
dashboardlogic.js
CHANGED
|
@@ -487,13 +487,19 @@ async function handleUpload(input) {
|
|
| 487 |
if (!client) {
|
| 488 |
client = await Client.connect("pockit-cloud/main", opts);
|
| 489 |
}
|
| 490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
user_id: currentUser,
|
| 492 |
password: currentPassword,
|
| 493 |
filepath: file,
|
| 494 |
custom_name: file.name,
|
| 495 |
});
|
| 496 |
-
const result = await job.result();
|
| 497 |
console.debug('Upload response:', result);
|
| 498 |
console.log('Uploaded:', file.name);
|
| 499 |
// Update storage
|
|
|
|
| 487 |
if (!client) {
|
| 488 |
client = await Client.connect("pockit-cloud/main", opts);
|
| 489 |
}
|
| 490 |
+
// Connect exactly as per docs; only pass token if present
|
| 491 |
+
const token = getWriteToken() || getReadToken() || '';
|
| 492 |
+
if (!client) {
|
| 493 |
+
client = token
|
| 494 |
+
? await Client.connect("pockit-cloud/main", { hf_token: token })
|
| 495 |
+
: await Client.connect("pockit-cloud/main");
|
| 496 |
+
}
|
| 497 |
+
const result = await client.predict("/upload_file_secure", {
|
| 498 |
user_id: currentUser,
|
| 499 |
password: currentPassword,
|
| 500 |
filepath: file,
|
| 501 |
custom_name: file.name,
|
| 502 |
});
|
|
|
|
| 503 |
console.debug('Upload response:', result);
|
| 504 |
console.log('Uploaded:', file.name);
|
| 505 |
// Update storage
|