Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,6 +32,7 @@ def end_session(req: gr.Request):
|
|
| 32 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 33 |
shutil.rmtree(user_dir)
|
| 34 |
|
|
|
|
| 35 |
def preprocess_image(image: Image.Image) -> Image.Image:
|
| 36 |
"""
|
| 37 |
Preprocess the input image for 3D generation.
|
|
@@ -49,6 +50,7 @@ def preprocess_image(image: Image.Image) -> Image.Image:
|
|
| 49 |
processed_image = pipeline.preprocess_image(image)
|
| 50 |
return processed_image
|
| 51 |
|
|
|
|
| 52 |
def preprocess_videos(video: str) -> List[Tuple[Image.Image, str]]:
|
| 53 |
"""
|
| 54 |
Preprocess the input video for multi-image 3D generation.
|
|
@@ -76,6 +78,7 @@ def preprocess_videos(video: str) -> List[Tuple[Image.Image, str]]:
|
|
| 76 |
processed_images = [pipeline.preprocess_image(image) for image in images]
|
| 77 |
return processed_images
|
| 78 |
|
|
|
|
| 79 |
def preprocess_images(images: List[Tuple[Image.Image, str]]) -> List[Image.Image]:
|
| 80 |
"""
|
| 81 |
Preprocess a list of input images for multi-image 3D generation.
|
|
@@ -434,4 +437,5 @@ if __name__ == "__main__":
|
|
| 434 |
pipeline = TrellisVGGTTo3DPipeline.from_pretrained("Stable-X/trellis-vggt-v0-1")
|
| 435 |
pipeline.cuda()
|
| 436 |
pipeline.VGGT_model.cuda()
|
|
|
|
| 437 |
demo.launch()
|
|
|
|
| 32 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
| 33 |
shutil.rmtree(user_dir)
|
| 34 |
|
| 35 |
+
@spaces.GPU
|
| 36 |
def preprocess_image(image: Image.Image) -> Image.Image:
|
| 37 |
"""
|
| 38 |
Preprocess the input image for 3D generation.
|
|
|
|
| 50 |
processed_image = pipeline.preprocess_image(image)
|
| 51 |
return processed_image
|
| 52 |
|
| 53 |
+
@spaces.GPU
|
| 54 |
def preprocess_videos(video: str) -> List[Tuple[Image.Image, str]]:
|
| 55 |
"""
|
| 56 |
Preprocess the input video for multi-image 3D generation.
|
|
|
|
| 78 |
processed_images = [pipeline.preprocess_image(image) for image in images]
|
| 79 |
return processed_images
|
| 80 |
|
| 81 |
+
@spaces.GPU
|
| 82 |
def preprocess_images(images: List[Tuple[Image.Image, str]]) -> List[Image.Image]:
|
| 83 |
"""
|
| 84 |
Preprocess a list of input images for multi-image 3D generation.
|
|
|
|
| 437 |
pipeline = TrellisVGGTTo3DPipeline.from_pretrained("Stable-X/trellis-vggt-v0-1")
|
| 438 |
pipeline.cuda()
|
| 439 |
pipeline.VGGT_model.cuda()
|
| 440 |
+
pipeline.birefnet_model.cuda()
|
| 441 |
demo.launch()
|