Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
9356f1d
1
Parent(s):
017eabf
add
Browse files
app.py
CHANGED
|
@@ -8,31 +8,8 @@ import spaces
|
|
| 8 |
import sys
|
| 9 |
import torch
|
| 10 |
|
| 11 |
-
# Install iopath first as it's a dependency
|
| 12 |
-
os.system("pip install iopath")
|
| 13 |
-
|
| 14 |
-
# Dynamically determine the correct wheel URL based on Python and PyTorch versions
|
| 15 |
-
pyt_version_str = torch.__version__.split("+")[0].replace(".", "")
|
| 16 |
-
cuda_version_str = torch.version.cuda.replace(".", "") if torch.cuda.is_available() else "cpu"
|
| 17 |
-
version_str = f"py3{sys.version_info.minor}_cu{cuda_version_str}_pyt{pyt_version_str}"
|
| 18 |
-
|
| 19 |
-
print(f"Looking for PyTorch3D wheel for: {version_str}")
|
| 20 |
os.system(f"pip install \"git+https://github.com/facebookresearch/pytorch3d.git\"")
|
| 21 |
|
| 22 |
-
# If the wheel installation fails, try installing from source
|
| 23 |
-
try:
|
| 24 |
-
import pytorch3d
|
| 25 |
-
print("PyTorch3D installed successfully from wheel")
|
| 26 |
-
except ImportError:
|
| 27 |
-
print("Wheel not found, attempting to install PyTorch3D from source")
|
| 28 |
-
os.system('pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"')
|
| 29 |
-
try:
|
| 30 |
-
import pytorch3d
|
| 31 |
-
print("PyTorch3D installed successfully from source")
|
| 32 |
-
except ImportError:
|
| 33 |
-
print("WARNING: Could not install PyTorch3D. Some functionality may be limited.")
|
| 34 |
-
# Continue without PyTorch3D - the app will need to handle missing functionality
|
| 35 |
-
|
| 36 |
import torch
|
| 37 |
import torch.nn as nn
|
| 38 |
import gradio as gr
|
|
|
|
| 8 |
import sys
|
| 9 |
import torch
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
os.system(f"pip install \"git+https://github.com/facebookresearch/pytorch3d.git\"")
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
import torch
|
| 14 |
import torch.nn as nn
|
| 15 |
import gradio as gr
|