Spaces:
Paused
Paused
Julian Bilcke
commited on
Commit
·
5c099f3
1
Parent(s):
5fa1539
improve the life sim quality a bit
Browse files- src/index.mts +9 -0
- src/production/renderScene.mts +1 -1
- src/types.mts +6 -0
- src/utils/segmentImage.mts +15 -0
src/index.mts
CHANGED
|
@@ -77,6 +77,15 @@ app.post("/render", async (req, res) => {
|
|
| 77 |
}
|
| 78 |
})
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
app.post("/:ownerId", async (req, res) => {
|
| 81 |
const request = req.body as VideoAPIRequest
|
| 82 |
|
|
|
|
| 77 |
}
|
| 78 |
})
|
| 79 |
|
| 80 |
+
/*
|
| 81 |
+
app.post("/segment", async (req, res) => {
|
| 82 |
+
const payload = req.body as
|
| 83 |
+
try {
|
| 84 |
+
await segmentImage()
|
| 85 |
+
}
|
| 86 |
+
})
|
| 87 |
+
*/
|
| 88 |
+
|
| 89 |
app.post("/:ownerId", async (req, res) => {
|
| 90 |
const request = req.body as VideoAPIRequest
|
| 91 |
|
src/production/renderScene.mts
CHANGED
|
@@ -28,7 +28,7 @@ export async function renderScene(prompt: string) {
|
|
| 28 |
seed: generateSeed(),
|
| 29 |
// seed,
|
| 30 |
nbFrames: 16,
|
| 31 |
-
nbSteps:
|
| 32 |
})
|
| 33 |
// console.log("successfull generation")
|
| 34 |
error = ""
|
|
|
|
| 28 |
seed: generateSeed(),
|
| 29 |
// seed,
|
| 30 |
nbFrames: 16,
|
| 31 |
+
nbSteps: 10,
|
| 32 |
})
|
| 33 |
// console.log("successfull generation")
|
| 34 |
error = ""
|
src/types.mts
CHANGED
|
@@ -268,3 +268,9 @@ export type VideoAPIRequest = Partial<{
|
|
| 268 |
export type Video = VideoSequence & {
|
| 269 |
shots: VideoShot[]
|
| 270 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
export type Video = VideoSequence & {
|
| 269 |
shots: VideoShot[]
|
| 270 |
}
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
export interface ImageSegmentationRequest {
|
| 274 |
+
image: string // in base64
|
| 275 |
+
keywords: string[]
|
| 276 |
+
}
|
src/utils/segmentImage.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { client } from "@gradio/client"
|
| 2 |
+
|
| 3 |
+
const response_0 = await fetch("https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png")
|
| 4 |
+
const exampleImage = await response_0.blob()
|
| 5 |
+
|
| 6 |
+
const app = await client("https://jbilcke-hf-grounded-segment-anything.hf.space/")
|
| 7 |
+
const result = await app.predict(0, [
|
| 8 |
+
exampleImage, // blob in 'Upload' Image component
|
| 9 |
+
"Howdy!", // string in 'Detection Prompt[To detect multiple objects, seperating each name with '.', like this: cat . dog . chair ]' Textbox component
|
| 10 |
+
0, // number (numeric value between 0.0 and 1.0) in 'Box Threshold' Slider component
|
| 11 |
+
0, // number (numeric value between 0.0 and 1.0) in 'Text Threshold' Slider component
|
| 12 |
+
0, // number (numeric value between 0.0 and 1.0) in 'IOU Threshold' Slider component
|
| 13 |
+
]) as any
|
| 14 |
+
|
| 15 |
+
console.log(result.data)
|