fffiloni commited on
Commit
6866022
1 Parent(s): 0d728e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -7
app.py CHANGED
@@ -10,16 +10,24 @@ import subprocess
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@stable"])
 
 
 
 
 
 
 
 
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
 
10
  from glob import glob
11
  import requests
12
 
13
+
14
+ def install_torch_scatter():
15
  try:
16
+ subprocess.check_call([
17
+ sys.executable,
18
+ "-m",
19
+ "pip",
20
+ "install",
21
+ "--no-build-isolation",
22
+ "torch-scatter==2.1.2"
23
+ ])
24
+ print("torch-scatter installed successfully.")
25
  except subprocess.CalledProcessError as e:
26
+ print("Error occurred while installing torch-scatter:", e)
27
+ sys.exit(1)
28
 
29
+ # Call the function during your app's initialization
30
+ install_torch_scatter()
31
 
32
  def remove_background(input_url):
33
  # Create a temporary folder for downloaded and processed images