jbilcke-hf HF staff commited on
Commit
3708e26
β€’
1 Parent(s): 8ace6c1

fix code to pass build validation

Browse files
package-lock.json CHANGED
@@ -8,6 +8,7 @@
8
  "name": "videochain-ui",
9
  "version": "0.1.0",
10
  "dependencies": {
 
11
  "@radix-ui/react-accordion": "^1.1.2",
12
  "@radix-ui/react-avatar": "^1.0.3",
13
  "@radix-ui/react-checkbox": "^1.0.4",
@@ -279,6 +280,19 @@
279
  "react-dom": ">=16.8.0"
280
  }
281
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  "node_modules/@humanwhocodes/config-array": {
283
  "version": "0.11.10",
284
  "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz",
@@ -2169,8 +2183,6 @@
2169
  "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz",
2170
  "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==",
2171
  "hasInstallScript": true,
2172
- "optional": true,
2173
- "peer": true,
2174
  "dependencies": {
2175
  "node-gyp-build": "^4.3.0"
2176
  },
@@ -4769,8 +4781,6 @@
4769
  "version": "4.6.0",
4770
  "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz",
4771
  "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==",
4772
- "optional": true,
4773
- "peer": true,
4774
  "bin": {
4775
  "node-gyp-build": "bin.js",
4776
  "node-gyp-build-optional": "optional.js",
@@ -5742,6 +5752,14 @@
5742
  "loose-envify": "^1.1.0"
5743
  }
5744
  },
 
 
 
 
 
 
 
 
5745
  "node_modules/semver": {
5746
  "version": "7.5.4",
5747
  "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
 
8
  "name": "videochain-ui",
9
  "version": "0.1.0",
10
  "dependencies": {
11
+ "@gradio/client": "^0.1.4",
12
  "@radix-ui/react-accordion": "^1.1.2",
13
  "@radix-ui/react-avatar": "^1.0.3",
14
  "@radix-ui/react-checkbox": "^1.0.4",
 
280
  "react-dom": ">=16.8.0"
281
  }
282
  },
283
+ "node_modules/@gradio/client": {
284
+ "version": "0.1.4",
285
+ "resolved": "https://registry.npmjs.org/@gradio/client/-/client-0.1.4.tgz",
286
+ "integrity": "sha512-iGu5PYpqOG6jq0l3+XoB8JCQ4ppoXSSb4T9IK2i1JckY2WXVW/x/MCVTc8WTouyu6o0h46shGWSjMSBr9Xnlug==",
287
+ "dependencies": {
288
+ "bufferutil": "^4.0.7",
289
+ "semiver": "^1.1.0",
290
+ "ws": "^8.13.0"
291
+ },
292
+ "engines": {
293
+ "node": ">=18.0.0"
294
+ }
295
+ },
296
  "node_modules/@humanwhocodes/config-array": {
297
  "version": "0.11.10",
298
  "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz",
 
2183
  "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz",
2184
  "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==",
2185
  "hasInstallScript": true,
 
 
2186
  "dependencies": {
2187
  "node-gyp-build": "^4.3.0"
2188
  },
 
4781
  "version": "4.6.0",
4782
  "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz",
4783
  "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==",
 
 
4784
  "bin": {
4785
  "node-gyp-build": "bin.js",
4786
  "node-gyp-build-optional": "optional.js",
 
5752
  "loose-envify": "^1.1.0"
5753
  }
5754
  },
5755
+ "node_modules/semiver": {
5756
+ "version": "1.1.0",
5757
+ "resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz",
5758
+ "integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==",
5759
+ "engines": {
5760
+ "node": ">=6"
5761
+ }
5762
+ },
5763
  "node_modules/semver": {
5764
  "version": "7.5.4",
5765
  "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
package.json CHANGED
@@ -9,6 +9,7 @@
9
  "lint": "next lint"
10
  },
11
  "dependencies": {
 
12
  "@radix-ui/react-accordion": "^1.1.2",
13
  "@radix-ui/react-avatar": "^1.0.3",
14
  "@radix-ui/react-checkbox": "^1.0.4",
 
9
  "lint": "next lint"
10
  },
11
  "dependencies": {
12
+ "@gradio/client": "^0.1.4",
13
  "@radix-ui/react-accordion": "^1.1.2",
14
  "@radix-ui/react-avatar": "^1.0.3",
15
  "@radix-ui/react-checkbox": "^1.0.4",
src/app/api/tasks/[uuid]/route.ts CHANGED
@@ -1,17 +1,8 @@
1
- import type { NextApiRequest, NextApiResponse } from "next"
2
-
3
- import { VideoTask } from "@/app/types"
4
- import { NextResponse } from "next/server"
5
  import { getTask } from "@/server"
6
 
7
  // TODO: implement some kind of quota system
8
- export async function GET(
9
- req: NextApiRequest,
10
- res: NextApiResponse<{
11
- task?: VideoTask
12
- error?: string
13
- }>
14
- ) {
15
  return NextResponse.json({
16
  task: await getTask(`${req.url?.split('/').pop() || ""}`)
17
  })
 
1
+ import { NextRequest, NextResponse } from "next/server"
 
 
 
2
  import { getTask } from "@/server"
3
 
4
  // TODO: implement some kind of quota system
5
+ export async function GET(req: NextRequest) {
 
 
 
 
 
 
6
  return NextResponse.json({
7
  task: await getTask(`${req.url?.split('/').pop() || ""}`)
8
  })
src/app/api/tasks/route.ts CHANGED
@@ -1,7 +1,7 @@
1
  import { VideoTask, VideoTaskRequest } from "@/app/types"
2
  import { getPendingTasks, submitNewTask } from "@/server"
3
- import { NextApiRequest, NextApiResponse } from "next"
4
- import { NextResponse } from "next/server"
5
 
6
  // TODO: implement some kind of quota system
7
  export async function GET() {
@@ -12,7 +12,7 @@ export async function GET() {
12
 
13
  // TODO: implement some kind of quota system
14
  export async function POST(
15
- req: NextApiRequest,
16
  res: NextApiResponse<VideoTask | {
17
  error?: string
18
  }>
 
1
  import { VideoTask, VideoTaskRequest } from "@/app/types"
2
  import { getPendingTasks, submitNewTask } from "@/server"
3
+ import { NextApiResponse } from "next"
4
+ import { NextRequest, NextResponse } from "next/server"
5
 
6
  // TODO: implement some kind of quota system
7
  export async function GET() {
 
12
 
13
  // TODO: implement some kind of quota system
14
  export async function POST(
15
+ req: NextRequest,
16
  res: NextApiResponse<VideoTask | {
17
  error?: string
18
  }>
src/core/interpolateVideo.ts DELETED
@@ -1,40 +0,0 @@
1
- import { promises as fs } from "node:fs"
2
- import path from "node:path"
3
- import { Blob } from "buffer"
4
- // import { blobFrom } from "fetch-blob"
5
-
6
- import { client } from "@gradio/client"
7
- import tmpDir from "temp-dir"
8
-
9
- import { downloadVideo } from "./downloadVideo"
10
-
11
- const instances: string[] = [
12
- `${process.env.VC_VIDEO_INTERPOLATION_SPACE_API_URL}`
13
- ]
14
-
15
- export const interpolateVideo = async (fileName: string) => {
16
-
17
- const inputFilePath = path.join(tmpDir, fileName)
18
-
19
- const instance = instances.shift()!
20
- instances.push(instance)
21
-
22
- const api = await client(instance)
23
-
24
- const video = await fs.readFile(inputFilePath)
25
-
26
- const blob = new Blob([video], { type: 'video/mp4' })
27
- // const blob = blobFrom(filePath)
28
- const result = await api.predict(1, [
29
- blob, // blob in 'parameter_5' Video component
30
- 1, // number (numeric value between 1 and 4) in 'Interpolation Steps' Slider component
31
- 24, // string in 'FPS output' Radio component
32
- ])
33
-
34
- const data = (result as any).data[0]
35
- console.log('raw data:', data)
36
- const { orig_name, data: remoteFilePath } = data
37
- const remoteUrl = `${instance}/file=${remoteFilePath}`
38
- console.log("remoteUrl:", remoteUrl)
39
- await downloadVideo(remoteUrl, fileName)
40
- }