Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
attempt fix upload
Browse files
ui/src/app/api/hf-hub/route.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import { NextRequest, NextResponse } from 'next/server';
|
| 2 |
import { whoAmI, createRepo, uploadFiles, datasetInfo } from '@huggingface/hub';
|
| 3 |
-
import { readdir, stat
|
|
|
|
| 4 |
import path from 'path';
|
| 5 |
|
| 6 |
export async function POST(request: NextRequest) {
|
|
@@ -73,8 +74,7 @@ export async function POST(request: NextRequest) {
|
|
| 73 |
};
|
| 74 |
|
| 75 |
const addUploadFile = async (absolutePath: string, repoFilePath: string) => {
|
| 76 |
-
|
| 77 |
-
addUploadContent(repoFilePath, buffer);
|
| 78 |
};
|
| 79 |
|
| 80 |
const walkDirectory = async (basePath: string, repoPrefix: string) => {
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from 'next/server';
|
| 2 |
import { whoAmI, createRepo, uploadFiles, datasetInfo } from '@huggingface/hub';
|
| 3 |
+
import { readdir, stat } from 'fs/promises';
|
| 4 |
+
import { createReadStream } from 'fs';
|
| 5 |
import path from 'path';
|
| 6 |
|
| 7 |
export async function POST(request: NextRequest) {
|
|
|
|
| 74 |
};
|
| 75 |
|
| 76 |
const addUploadFile = async (absolutePath: string, repoFilePath: string) => {
|
| 77 |
+
addUploadContent(repoFilePath, createReadStream(absolutePath));
|
|
|
|
| 78 |
};
|
| 79 |
|
| 80 |
const walkDirectory = async (basePath: string, repoPrefix: string) => {
|