Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,11 @@ import gradio as gr
|
|
2 |
import spaces
|
3 |
from gradio_litmodel3d import LitModel3D
|
4 |
|
|
|
|
|
|
|
|
|
|
|
5 |
# Install local wheels at runtime
|
6 |
def install_local_wheels():
|
7 |
"""Install the local wheel files that couldn't be installed during Docker build."""
|
@@ -19,8 +24,6 @@ def install_local_wheels():
|
|
19 |
# Install wheels before importing trellis
|
20 |
install_local_wheels()
|
21 |
|
22 |
-
import os
|
23 |
-
import shutil
|
24 |
os.environ['SPCONV_ALGO'] = 'native'
|
25 |
from typing import *
|
26 |
import torch
|
@@ -46,7 +49,8 @@ def start_session(req: gr.Request):
|
|
46 |
|
47 |
def end_session(req: gr.Request):
|
48 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
49 |
-
|
|
|
50 |
|
51 |
|
52 |
def preprocess_image(image: Image.Image) -> Image.Image:
|
|
|
2 |
import spaces
|
3 |
from gradio_litmodel3d import LitModel3D
|
4 |
|
5 |
+
import os
|
6 |
+
import shutil
|
7 |
+
import subprocess
|
8 |
+
import sys
|
9 |
+
|
10 |
# Install local wheels at runtime
|
11 |
def install_local_wheels():
|
12 |
"""Install the local wheel files that couldn't be installed during Docker build."""
|
|
|
24 |
# Install wheels before importing trellis
|
25 |
install_local_wheels()
|
26 |
|
|
|
|
|
27 |
os.environ['SPCONV_ALGO'] = 'native'
|
28 |
from typing import *
|
29 |
import torch
|
|
|
49 |
|
50 |
def end_session(req: gr.Request):
|
51 |
user_dir = os.path.join(TMP_DIR, str(req.session_hash))
|
52 |
+
if os.path.exists(user_dir):
|
53 |
+
shutil.rmtree(user_dir)
|
54 |
|
55 |
|
56 |
def preprocess_image(image: Image.Image) -> Image.Image:
|