Spaces:
Running
on
L40S
Running
on
L40S
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,17 @@ import subprocess
|
|
10 |
from glob import glob
|
11 |
import requests
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
def remove_background(input_url):
|
14 |
# Create a temporary folder for downloaded and processed images
|
15 |
temp_dir = tempfile.mkdtemp()
|
|
|
10 |
from glob import glob
|
11 |
import requests
|
12 |
|
13 |
+
# Ensure the required package is installed
|
14 |
+
def install_dependencies():
|
15 |
+
try:
|
16 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "git+https://github.com/facebookresearch/pytorch3d.git@75ebeeaea0908c5527e7b1e305fbc7681382db47"])
|
17 |
+
except subprocess.CalledProcessError as e:
|
18 |
+
print(f"Error installing dependencies: {e}")
|
19 |
+
sys.exit(1) # Exit the script if installation fails
|
20 |
+
|
21 |
+
# Install dependencies at the start
|
22 |
+
install_dependencies()
|
23 |
+
|
24 |
def remove_background(input_url):
|
25 |
# Create a temporary folder for downloaded and processed images
|
26 |
temp_dir = tempfile.mkdtemp()
|