Spaces:
Paused
Paused
Ali Mohsin
commited on
Commit
Β·
77b97f3
1
Parent(s):
63e7e53
more fixes
Browse files
app.py
CHANGED
|
@@ -30,67 +30,77 @@ except:
|
|
| 30 |
# Check if complex dependencies are installed
|
| 31 |
def check_complex_dependencies():
|
| 32 |
"""Check if complex dependencies are available"""
|
|
|
|
|
|
|
|
|
|
| 33 |
try:
|
| 34 |
import nvdiffrast
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
import pytorch3d
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
return False
|
| 49 |
-
except:
|
| 50 |
-
return False
|
| 51 |
-
|
| 52 |
-
# Check if torch-scatter is available (not critical)
|
| 53 |
-
try:
|
| 54 |
-
import torch_scatter
|
| 55 |
-
except ImportError:
|
| 56 |
-
print("torch-scatter not available, but this may not be critical")
|
| 57 |
-
|
| 58 |
-
# Try to safely import torchvision
|
| 59 |
try:
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
print("WARNING: Compatibility issue with torchvision. Will attempt to continue anyway.")
|
| 65 |
else:
|
| 66 |
-
print(
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
return False
|
| 74 |
-
|
| 75 |
-
# Run post-install if needed
|
| 76 |
-
if not check_complex_dependencies():
|
| 77 |
-
print("Complex dependencies not found, running post-install...")
|
| 78 |
try:
|
| 79 |
-
import
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
# Enhanced torchvision compatibility handling
|
| 96 |
def apply_torchvision_fix():
|
|
@@ -192,6 +202,7 @@ if import_success:
|
|
| 192 |
else:
|
| 193 |
print(f"οΏ½οΏ½ Processing engine failed to load: {loop_import_error}")
|
| 194 |
print("The interface will still start, but processing functionality will be limited.")
|
|
|
|
| 195 |
|
| 196 |
# Ensure NeuralJacobianFields is properly configured
|
| 197 |
try:
|
|
@@ -602,8 +613,8 @@ def create_interface():
|
|
| 602 |
engine_status = "β
Processing engine loaded successfully"
|
| 603 |
status_msg = "Ready to generate garments. Select an input method and click 'Generate 3D Garment'."
|
| 604 |
else:
|
| 605 |
-
engine_status = f"
|
| 606 |
-
status_msg = "Processing engine is currently unavailable.
|
| 607 |
|
| 608 |
engine_status_output = gr.Markdown(f"**System Status:** {engine_status}")
|
| 609 |
status_output = gr.Markdown(status_msg)
|
|
|
|
| 30 |
# Check if complex dependencies are installed
|
| 31 |
def check_complex_dependencies():
|
| 32 |
"""Check if complex dependencies are available"""
|
| 33 |
+
dependencies_ok = True
|
| 34 |
+
missing_deps = []
|
| 35 |
+
|
| 36 |
try:
|
| 37 |
import nvdiffrast
|
| 38 |
+
print("β nvdiffrast available")
|
| 39 |
+
except ImportError:
|
| 40 |
+
print("β nvdiffrast not available")
|
| 41 |
+
dependencies_ok = False
|
| 42 |
+
missing_deps.append("nvdiffrast")
|
| 43 |
+
|
| 44 |
+
try:
|
| 45 |
import pytorch3d
|
| 46 |
+
print("β pytorch3d available")
|
| 47 |
+
except ImportError:
|
| 48 |
+
print("β pytorch3d not available")
|
| 49 |
+
dependencies_ok = False
|
| 50 |
+
missing_deps.append("pytorch3d")
|
| 51 |
+
|
| 52 |
+
# Check if torch-sparse is available or disabled
|
| 53 |
+
try:
|
| 54 |
+
import torch_sparse
|
| 55 |
+
print("β torch-sparse available")
|
| 56 |
+
except ImportError:
|
| 57 |
+
# Check if torch-sparse was disabled
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
try:
|
| 59 |
+
with open("NeuralJacobianFields/PoissonSystem.py", 'r') as f:
|
| 60 |
+
content = f.read()
|
| 61 |
+
if "USE_TORCH_SPARSE = False" in content:
|
| 62 |
+
print("β torch-sparse is disabled, using built-in PyTorch sparse operations")
|
|
|
|
| 63 |
else:
|
| 64 |
+
print("β torch-sparse not available")
|
| 65 |
+
missing_deps.append("torch-sparse")
|
| 66 |
+
except:
|
| 67 |
+
print("β torch-sparse not available")
|
| 68 |
+
missing_deps.append("torch-sparse")
|
| 69 |
+
|
| 70 |
+
# Check if torch-scatter is available (not critical)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
try:
|
| 72 |
+
import torch_scatter
|
| 73 |
+
print("β torch-scatter available")
|
| 74 |
+
except ImportError:
|
| 75 |
+
print("β torch-scatter not available, but this may not be critical")
|
| 76 |
+
|
| 77 |
+
# Try to safely import torchvision
|
| 78 |
+
try:
|
| 79 |
+
import torchvision
|
| 80 |
+
print(f"β torchvision {torchvision.__version__} loaded successfully")
|
| 81 |
+
except RuntimeError as e:
|
| 82 |
+
if "operator torchvision::nms does not exist" in str(e):
|
| 83 |
+
print("β Compatibility issue with torchvision. Will attempt to continue anyway.")
|
| 84 |
+
else:
|
| 85 |
+
print(f"β torchvision error: {e}")
|
| 86 |
+
except ImportError:
|
| 87 |
+
print("β torchvision not available")
|
| 88 |
+
|
| 89 |
+
if missing_deps:
|
| 90 |
+
print(f"Missing dependencies: {', '.join(missing_deps)}")
|
| 91 |
+
|
| 92 |
+
return dependencies_ok
|
| 93 |
+
|
| 94 |
+
# Check dependencies but don't fail if some are missing
|
| 95 |
+
print("Checking dependencies...")
|
| 96 |
+
deps_ok = check_complex_dependencies()
|
| 97 |
+
|
| 98 |
+
if not deps_ok:
|
| 99 |
+
print("Some dependencies are missing, but continuing anyway...")
|
| 100 |
+
print("The app will start with limited functionality.")
|
| 101 |
+
print("You can install missing dependencies manually if needed.")
|
| 102 |
+
else:
|
| 103 |
+
print("All dependencies are available!")
|
| 104 |
|
| 105 |
# Enhanced torchvision compatibility handling
|
| 106 |
def apply_torchvision_fix():
|
|
|
|
| 202 |
else:
|
| 203 |
print(f"οΏ½οΏ½ Processing engine failed to load: {loop_import_error}")
|
| 204 |
print("The interface will still start, but processing functionality will be limited.")
|
| 205 |
+
print("This is normal in Dev Mode if dependencies are still being installed.")
|
| 206 |
|
| 207 |
# Ensure NeuralJacobianFields is properly configured
|
| 208 |
try:
|
|
|
|
| 613 |
engine_status = "β
Processing engine loaded successfully"
|
| 614 |
status_msg = "Ready to generate garments. Select an input method and click 'Generate 3D Garment'."
|
| 615 |
else:
|
| 616 |
+
engine_status = f"β οΈ Processing engine unavailable: {loop_import_error or 'Unknown error'}"
|
| 617 |
+
status_msg = "Processing engine is currently unavailable. This is normal in Dev Mode if dependencies are still being installed. The interface will work once dependencies are ready."
|
| 618 |
|
| 619 |
engine_status_output = gr.Markdown(f"**System Status:** {engine_status}")
|
| 620 |
status_output = gr.Markdown(status_msg)
|