Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
·
74bfab8
1
Parent(s):
1c6f9de
use the .env.local file
Browse files- .env.sample +101 -0
- .gitignore +2 -1
- package-lock.json +12 -0
- package.json +1 -0
- src/index.mts +5 -0
- src/providers/video-generation/generateVideoWithHotshotGradioAPI.mts +7 -0
- src/providers/video-generation/generateVideoWithHotshotReplicate.mts +4 -4
- src/providers/video-interpolation/interpolateVideoWithReplicate.mts +4 -4
.env.sample
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
#--------------------- GENERATION CONFIGURATION -------------------
|
3 |
+
# if deployed to Hugging Face (with persistent storage enabled)
|
4 |
+
VC_STORAGE_PATH="/data/"
|
5 |
+
|
6 |
+
# for a local usage on your dev machine
|
7 |
+
#VC_STORAGE_PATH="./sandbox"
|
8 |
+
|
9 |
+
#--------------------- AUTH SECRETS AND ACCESS TOKENS -------------
|
10 |
+
# The access token required to send some queries to VideoChain
|
11 |
+
VC_SECRET_ACCESS_TOKEN="<USE YOUR OWN>"
|
12 |
+
|
13 |
+
# The access token required to send queries to some sub-servers
|
14 |
+
VC_MICROSERVICE_SECRET_TOKEN="<USE YOUR OWN>"
|
15 |
+
|
16 |
+
# OpenAI API key used to call OpenAI API services
|
17 |
+
VC_OPENAI_API_KEY="<USE YOUR OWN>"
|
18 |
+
|
19 |
+
# Hugging Face API key used to call Hugging Face spaces
|
20 |
+
VC_HF_API_TOKEN="<USE YOUR OWN>"
|
21 |
+
|
22 |
+
#--------------------- LLM INFERENCE SERVERS ----------------------
|
23 |
+
VC_INFERENCE_ENDPOINT_URL="<USE YOUR OWN>"
|
24 |
+
|
25 |
+
#--------------------- SDXL INFERENCE SERVERS ---------------------
|
26 |
+
VC_SDXL_SPACE_API_URL_1="https://jbilcke-hf-image-server-1.hf.space"
|
27 |
+
VC_SDXL_SPACE_API_URL_2="https://jbilcke-hf-image-server-2.hf.space"
|
28 |
+
VC_SDXL_SPACE_API_URL_3="https://jbilcke-hf-image-server-3.hf.space"
|
29 |
+
VC_SDXL_SPACE_API_URL_4="https://jbilcke-hf-image-server-4.hf.space"
|
30 |
+
VC_SDXL_SPACE_API_URL_5="https://jbilcke-hf-image-server-5.hf.space"
|
31 |
+
VC_SDXL_SPACE_API_URL_6="https://jbilcke-hf-image-server-6.hf.space"
|
32 |
+
VC_SDXL_SPACE_API_URL_7="https://jbilcke-hf-image-server-7.hf.space"
|
33 |
+
VC_SDXL_SPACE_API_URL_8="https://jbilcke-hf-image-server-8.hf.space"
|
34 |
+
VC_SDXL_SPACE_API_URL_9="https://jbilcke-hf-image-server-9.hf.space"
|
35 |
+
VC_SDXL_SPACE_API_URL_10="https://jbilcke-hf-image-server-10.hf.space"
|
36 |
+
VC_SDXL_SPACE_API_URL_11="https://jbilcke-hf-image-server-11.hf.space"
|
37 |
+
VC_SDXL_SPACE_API_URL_12="https://jbilcke-hf-image-server-12.hf.space"
|
38 |
+
VC_SDXL_SPACE_API_URL_13="https://jbilcke-hf-image-server-13.hf.space"
|
39 |
+
VC_SDXL_SPACE_API_URL_14="https://jbilcke-hf-image-server-14.hf.space"
|
40 |
+
VC_SDXL_SPACE_API_URL_15="https://jbilcke-hf-image-server-15.hf.space"
|
41 |
+
VC_SDXL_SPACE_API_URL_16="https://jbilcke-hf-image-server-16.hf.space"
|
42 |
+
VC_SDXL_SPACE_API_URL_17="https://jbilcke-hf-image-server-17.hf.space"
|
43 |
+
VC_SDXL_SPACE_API_URL_18="https://jbilcke-hf-image-server-18.hf.space"
|
44 |
+
|
45 |
+
#----------------- ZEROSCOPE INFERENCE SERVERS -------------------
|
46 |
+
VC_ZEROSCOPE_SPACE_API_URL_1="https://jbilcke-hf-video-server-1.hf.space"
|
47 |
+
VC_ZEROSCOPE_SPACE_API_URL_2="https://jbilcke-hf-video-server-2.hf.space"
|
48 |
+
VC_ZEROSCOPE_SPACE_API_URL_3="https://jbilcke-hf-video-server-3.hf.space"
|
49 |
+
VC_ZEROSCOPE_SPACE_API_URL_4="https://jbilcke-hf-video-server-4.hf.space"
|
50 |
+
|
51 |
+
#----------------- HOTSHOT-XL INFERENCE SERVERS -------------------
|
52 |
+
VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_1="https://jbilcke-hf-hotshot-xl-server-1.hf.space"
|
53 |
+
VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_2="https://jbilcke-hf-hotshot-xl-server-2.hf.space"
|
54 |
+
VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_3="https://jbilcke-hf-hotshot-xl-server-3.hf.space"
|
55 |
+
VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_4="https://jbilcke-hf-hotshot-xl-server-4.hf.space"
|
56 |
+
VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_5="https://jbilcke-hf-hotshot-xl-server-5.hf.space"
|
57 |
+
VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_6="https://jbilcke-hf-hotshot-xl-server-6.hf.space"
|
58 |
+
VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_7="https://jbilcke-hf-hotshot-xl-server-7.hf.space"
|
59 |
+
VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_8="https://jbilcke-hf-hotshot-xl-server-8.hf.space"
|
60 |
+
|
61 |
+
|
62 |
+
#----------------- HOTSHOT-XL REPLICATE CONFIG --------------------
|
63 |
+
VC_HOTSHOT_XL_REPLICATE_MODEL="cloneofsimo/hotshot-xl-lora-controlnet"
|
64 |
+
VC_HOTSHOT_XL_REPLICATE_MODEL_VERSION="c447ef9fc621af091e2c06d08fd2a22d9f5906389a2f8103c851a2f7cf9c4e63"
|
65 |
+
|
66 |
+
#----------------- FRAME SEGMENTATION SERVERS ---------------------
|
67 |
+
VC_SEGMENTATION_MODULE_SPACE_API_URL_1="https://jbilcke-hf-segmentation-server-1.hf.space"
|
68 |
+
VC_SEGMENTATION_MODULE_SPACE_API_URL_2="https://jbilcke-hf-segmentation-server-2.hf.space"
|
69 |
+
VC_SEGMENTATION_MODULE_SPACE_API_URL_3="https://jbilcke-hf-segmentation-server-3.hf.space"
|
70 |
+
|
71 |
+
# obsolete:
|
72 |
+
VC_SEGMENTATION_MODULE_SPACE_API_URL="https://jbilcke-hf-image-segmentation.hf.space"
|
73 |
+
|
74 |
+
#----------------- PANORAMA GENERATION SERVERS -------------------
|
75 |
+
VC_SDXL_360_SPACE_API_URL_1="https://jbilcke-hf-360-server-1.hf.space"
|
76 |
+
|
77 |
+
#----------------- IMAGE UPSCALING SERVERS -----------------------
|
78 |
+
VC_UPSCALING_SPACE_API_URL_1="https://jbilcke-hf-upscaling-server-1.hf.space"
|
79 |
+
VC_UPSCALING_SPACE_API_URL_2="https://jbilcke-hf-upscaling-server-2.hf.space"
|
80 |
+
VC_UPSCALING_SPACE_API_URL_3="https://jbilcke-hf-upscaling-server-3.hf.space"
|
81 |
+
VC_UPSCALING_SPACE_API_URL_4="https://jbilcke-hf-upscaling-server-4.hf.space"
|
82 |
+
|
83 |
+
#----------------- VIDEO UPSCALING SERVERS -----------------------
|
84 |
+
VC_VIDEO_UPSCALE_SPACE_API_URL_1="https://jbilcke-hf-video-upscaling-server-1.hf.space"
|
85 |
+
|
86 |
+
#----------------- VIDEO INTERPOLATION (FILM) SERVERS -------------------
|
87 |
+
VC_VIDEO_INTERPOLATION_SPACE_API_URL="https://jbilcke-hf-video-frame-interpolation.hf.space"
|
88 |
+
|
89 |
+
#----------------- VIDEO INTERPOLATION (ST-MFNET) CONFIG -------------------
|
90 |
+
VC_VIDEO_INTERPOLATION_STMFNET_REPLICATE_MODEL="hzsxkib/st-mfnet"
|
91 |
+
VC_VIDEO_INTERPOLATION_STMFNET_REPLICATE_MODEL_VERSION="faa7693430b0a4ac95d1b8e25165673c1d7a7263537a7c4bb9be82a3e2d130fb"
|
92 |
+
|
93 |
+
#----------------- AUDIO GENERATION SERVERS ----------------------
|
94 |
+
VC_AUDIO_GENERATION_SPACE_API_URL="https://jbilcke-hf-audioldm-text-to-audio-generation.hf.space"
|
95 |
+
|
96 |
+
#----------------- IMAGE ANALYSIS SERVERS ----------------------
|
97 |
+
VC_ANALYSIS_SPACE_API_URL="https://huggingfacem4-idefics-playground.hf.space"
|
98 |
+
|
99 |
+
#----------------- SPEECH TO TEXT SERVERS ----------------------
|
100 |
+
VC_SPEECH_TO_TEXT_SPACE_API_URL_1="https://jbilcke-hf-speech-recognition-server-1.hf.space"
|
101 |
+
|
.gitignore
CHANGED
@@ -5,4 +5,5 @@ node_modules
|
|
5 |
.venv
|
6 |
*.mp4
|
7 |
sandbox
|
8 |
-
scripts
|
|
|
|
5 |
.venv
|
6 |
*.mp4
|
7 |
sandbox
|
8 |
+
scripts
|
9 |
+
.env.local
|
package-lock.json
CHANGED
@@ -16,6 +16,7 @@
|
|
16 |
"@types/express": "^4.17.17",
|
17 |
"@types/ffmpeg-concat": "^1.1.2",
|
18 |
"@types/uuid": "^9.0.2",
|
|
|
19 |
"eventsource-parser": "^1.0.0",
|
20 |
"express": "^4.18.2",
|
21 |
"ffmpeg-concat": "^1.3.0",
|
@@ -1474,6 +1475,17 @@
|
|
1474 |
"node": ">=0.3.1"
|
1475 |
}
|
1476 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1477 |
"node_modules/dup": {
|
1478 |
"version": "1.0.0",
|
1479 |
"resolved": "https://registry.npmjs.org/dup/-/dup-1.0.0.tgz",
|
|
|
16 |
"@types/express": "^4.17.17",
|
17 |
"@types/ffmpeg-concat": "^1.1.2",
|
18 |
"@types/uuid": "^9.0.2",
|
19 |
+
"dotenv": "^16.3.1",
|
20 |
"eventsource-parser": "^1.0.0",
|
21 |
"express": "^4.18.2",
|
22 |
"ffmpeg-concat": "^1.3.0",
|
|
|
1475 |
"node": ">=0.3.1"
|
1476 |
}
|
1477 |
},
|
1478 |
+
"node_modules/dotenv": {
|
1479 |
+
"version": "16.3.1",
|
1480 |
+
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
|
1481 |
+
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
|
1482 |
+
"engines": {
|
1483 |
+
"node": ">=12"
|
1484 |
+
},
|
1485 |
+
"funding": {
|
1486 |
+
"url": "https://github.com/motdotla/dotenv?sponsor=1"
|
1487 |
+
}
|
1488 |
+
},
|
1489 |
"node_modules/dup": {
|
1490 |
"version": "1.0.0",
|
1491 |
"resolved": "https://registry.npmjs.org/dup/-/dup-1.0.0.tgz",
|
package.json
CHANGED
@@ -23,6 +23,7 @@
|
|
23 |
"@types/express": "^4.17.17",
|
24 |
"@types/ffmpeg-concat": "^1.1.2",
|
25 |
"@types/uuid": "^9.0.2",
|
|
|
26 |
"eventsource-parser": "^1.0.0",
|
27 |
"express": "^4.18.2",
|
28 |
"ffmpeg-concat": "^1.3.0",
|
|
|
23 |
"@types/express": "^4.17.17",
|
24 |
"@types/ffmpeg-concat": "^1.1.2",
|
25 |
"@types/uuid": "^9.0.2",
|
26 |
+
"dotenv": "^16.3.1",
|
27 |
"eventsource-parser": "^1.0.0",
|
28 |
"express": "^4.18.2",
|
29 |
"ffmpeg-concat": "^1.3.0",
|
src/index.mts
CHANGED
@@ -3,6 +3,11 @@ import path from "node:path"
|
|
3 |
|
4 |
import { validate as uuidValidate } from "uuid"
|
5 |
import express from "express"
|
|
|
|
|
|
|
|
|
|
|
6 |
import { Video, VideoStatus, VideoAPIRequest, RenderRequest, RenderedScene, ImageAnalysisRequest, ImageAnalysisResponse, SoundAnalysisResponse, SoundAnalysisRequest } from "./types.mts"
|
7 |
|
8 |
import { parseVideoRequest } from "./utils/requests/parseVideoRequest.mts"
|
|
|
3 |
|
4 |
import { validate as uuidValidate } from "uuid"
|
5 |
import express from "express"
|
6 |
+
|
7 |
+
import dotenv from "dotenv"
|
8 |
+
|
9 |
+
dotenv.config({ path: ".env.local" })
|
10 |
+
|
11 |
import { Video, VideoStatus, VideoAPIRequest, RenderRequest, RenderedScene, ImageAnalysisRequest, ImageAnalysisResponse, SoundAnalysisResponse, SoundAnalysisRequest } from "./types.mts"
|
12 |
|
13 |
import { parseVideoRequest } from "./utils/requests/parseVideoRequest.mts"
|
src/providers/video-generation/generateVideoWithHotshotGradioAPI.mts
CHANGED
@@ -7,6 +7,13 @@ import { generateSeed } from "../../utils/misc/generateSeed.mts"
|
|
7 |
// we don't use replicas yet, because it ain't easy to get their hostname
|
8 |
const instances: string[] = [
|
9 |
`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_1 || ""}`,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
].filter(instance => instance?.length > 0)
|
11 |
|
12 |
const secretToken = `${process.env.VC_MICROSERVICE_SECRET_TOKEN || ""}`
|
|
|
7 |
// we don't use replicas yet, because it ain't easy to get their hostname
|
8 |
const instances: string[] = [
|
9 |
`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_1 || ""}`,
|
10 |
+
//`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_2 || ""}`,
|
11 |
+
//`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_3 || ""}`,
|
12 |
+
//`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_4 || ""}`,
|
13 |
+
//`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_5 || ""}`,
|
14 |
+
//`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_6 || ""}`,
|
15 |
+
//`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_7 || ""}`,
|
16 |
+
//`${process.env.VC_HOTSHOT_XL_GRADIO_SPACE_API_URL_8 || ""}`,
|
17 |
].filter(instance => instance?.length > 0)
|
18 |
|
19 |
const secretToken = `${process.env.VC_MICROSERVICE_SECRET_TOKEN || ""}`
|
src/providers/video-generation/generateVideoWithHotshotReplicate.mts
CHANGED
@@ -8,8 +8,8 @@ import { getNegativePrompt, getPositivePrompt } from "./defaultPrompts.mts"
|
|
8 |
import { VideoGenerationOptions } from "./types.mts"
|
9 |
|
10 |
const replicateToken = `${process.env.AUTH_REPLICATE_API_TOKEN || ""}`
|
11 |
-
const replicateModel = `${process.env.
|
12 |
-
const replicateModelVersion = `${process.env.
|
13 |
|
14 |
if (!replicateToken) {
|
15 |
throw new Error(`you need to configure your AUTH_REPLICATE_API_TOKEN`)
|
@@ -49,11 +49,11 @@ export async function generateVideoWithHotshotReplicate({
|
|
49 |
}
|
50 |
|
51 |
if (!replicateModel) {
|
52 |
-
throw new Error(`you need to configure your
|
53 |
}
|
54 |
|
55 |
if (!replicateModelVersion) {
|
56 |
-
throw new Error(`you need to configure your
|
57 |
}
|
58 |
|
59 |
// pimp the prompt
|
|
|
8 |
import { VideoGenerationOptions } from "./types.mts"
|
9 |
|
10 |
const replicateToken = `${process.env.AUTH_REPLICATE_API_TOKEN || ""}`
|
11 |
+
const replicateModel = `${process.env.VC_HOTSHOT_XL_REPLICATE_MODEL || ""}`
|
12 |
+
const replicateModelVersion = `${process.env.VC_HOTSHOT_XL_REPLICATE_MODEL_VERSION || ""}`
|
13 |
|
14 |
if (!replicateToken) {
|
15 |
throw new Error(`you need to configure your AUTH_REPLICATE_API_TOKEN`)
|
|
|
49 |
}
|
50 |
|
51 |
if (!replicateModel) {
|
52 |
+
throw new Error(`you need to configure your VC_HOTSHOT_XL_REPLICATE_MODEL`)
|
53 |
}
|
54 |
|
55 |
if (!replicateModelVersion) {
|
56 |
+
throw new Error(`you need to configure your VC_HOTSHOT_XL_REPLICATE_MODEL_VERSION`)
|
57 |
}
|
58 |
|
59 |
// pimp the prompt
|
src/providers/video-interpolation/interpolateVideoWithReplicate.mts
CHANGED
@@ -9,8 +9,8 @@ import Replicate from "replicate"
|
|
9 |
import { sleep } from "../../utils/misc/sleep.mts"
|
10 |
|
11 |
const replicateToken = `${process.env.AUTH_REPLICATE_API_TOKEN || ""}`
|
12 |
-
const replicateModel = `${process.env.
|
13 |
-
const replicateModelVersion = `${process.env.
|
14 |
|
15 |
if (!replicateToken) {
|
16 |
throw new Error(`you need to configure your AUTH_REPLICATE_API_TOKEN`)
|
@@ -45,11 +45,11 @@ export async function interpolateVideoWithReplicate({
|
|
45 |
}
|
46 |
|
47 |
if (!replicateModel) {
|
48 |
-
throw new Error(`you need to configure your
|
49 |
}
|
50 |
|
51 |
if (!replicateModelVersion) {
|
52 |
-
throw new Error(`you need to configure your
|
53 |
}
|
54 |
|
55 |
// for params and doc see https://replicate.com/zsxkib/st-mfnet
|
|
|
9 |
import { sleep } from "../../utils/misc/sleep.mts"
|
10 |
|
11 |
const replicateToken = `${process.env.AUTH_REPLICATE_API_TOKEN || ""}`
|
12 |
+
const replicateModel = `${process.env.VC_VIDEO_INTERPOLATION_STMFNET_REPLICATE_MODEL || ""}`
|
13 |
+
const replicateModelVersion = `${process.env.VC_VIDEO_INTERPOLATION_STMFNET_REPLICATE_MODEL_VERSION || ""}`
|
14 |
|
15 |
if (!replicateToken) {
|
16 |
throw new Error(`you need to configure your AUTH_REPLICATE_API_TOKEN`)
|
|
|
45 |
}
|
46 |
|
47 |
if (!replicateModel) {
|
48 |
+
throw new Error(`you need to configure your VC_VIDEO_INTERPOLATION_STMFNET_REPLICATE_MODEL`)
|
49 |
}
|
50 |
|
51 |
if (!replicateModelVersion) {
|
52 |
+
throw new Error(`you need to configure your VC_VIDEO_INTERPOLATION_STMFNET_REPLICATE_MODEL_VERSION`)
|
53 |
}
|
54 |
|
55 |
// for params and doc see https://replicate.com/zsxkib/st-mfnet
|