Spaces:
Runtime error
Runtime error
Create setup_texturing.py
Browse files- setup_texturing.py +28 -0
setup_texturing.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
def run_setup(directory):
|
| 6 |
+
try:
|
| 7 |
+
os.chdir(directory)
|
| 8 |
+
result = subprocess.run([sys.executable, "setup.py", "install"], check=True, capture_output=True, text=True)
|
| 9 |
+
print(f"Successfully installed {directory}: {result.stdout}")
|
| 10 |
+
except subprocess.CalledProcessError as e:
|
| 11 |
+
print(f"Error installing {directory}: {e.stderr}")
|
| 12 |
+
except Exception as e:
|
| 13 |
+
print(f"Unexpected error in {directory}: {e}")
|
| 14 |
+
|
| 15 |
+
# Install custom_rasterizer
|
| 16 |
+
run_setup("hy3dgen/texgen/custom_rasterizer")
|
| 17 |
+
|
| 18 |
+
# Install differentiable_renderer
|
| 19 |
+
run_setup("hy3dgen/texgen/differentiable_renderer")
|
| 20 |
+
|
| 21 |
+
# Download Real-ESRGAN model
|
| 22 |
+
try:
|
| 23 |
+
os.makedirs("hy3dpaint/ckpt", exist_ok=True)
|
| 24 |
+
realesrgan_url = "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth"
|
| 25 |
+
subprocess.run(["wget", realesrgan_url, "-P", "hy3dpaint/ckpt"], check=True, capture_output=True, text=True)
|
| 26 |
+
print("Successfully downloaded Real-ESRGAN model")
|
| 27 |
+
except Exception as e:
|
| 28 |
+
print(f"Error downloading Real-ESRGAN: {e}")
|