Spaces:
Paused
Paused
Delete run.py
Browse files
run.py
DELETED
|
@@ -1,70 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
Entry point for Hugging Face Spaces
|
| 4 |
-
This script handles the startup and runs the Gradio interface
|
| 5 |
-
"""
|
| 6 |
-
|
| 7 |
-
import os
|
| 8 |
-
import sys
|
| 9 |
-
import subprocess
|
| 10 |
-
|
| 11 |
-
def check_dependencies():
|
| 12 |
-
"""Check if all dependencies are installed"""
|
| 13 |
-
try:
|
| 14 |
-
import torch
|
| 15 |
-
import gradio
|
| 16 |
-
import clip
|
| 17 |
-
print("✓ Basic dependencies are available")
|
| 18 |
-
return True
|
| 19 |
-
except ImportError as e:
|
| 20 |
-
print(f"✗ Missing basic dependencies: {e}")
|
| 21 |
-
return False
|
| 22 |
-
|
| 23 |
-
def run_setup_if_needed():
|
| 24 |
-
"""Run setup script if needed"""
|
| 25 |
-
if not os.path.exists("packages/nvdiffrast"):
|
| 26 |
-
print("Running setup script...")
|
| 27 |
-
try:
|
| 28 |
-
subprocess.run([sys.executable, "setup_spaces.py"], check=True)
|
| 29 |
-
print("✓ Setup completed successfully")
|
| 30 |
-
except subprocess.CalledProcessError as e:
|
| 31 |
-
print(f"✗ Setup failed: {e}")
|
| 32 |
-
return False
|
| 33 |
-
else:
|
| 34 |
-
print("✓ Dependencies already installed")
|
| 35 |
-
return True
|
| 36 |
-
|
| 37 |
-
def main():
|
| 38 |
-
"""Main function"""
|
| 39 |
-
print("Starting Garment3DGen for Hugging Face Spaces...")
|
| 40 |
-
|
| 41 |
-
# Check basic dependencies
|
| 42 |
-
if not check_dependencies():
|
| 43 |
-
print("Basic dependencies are missing. Please check the installation.")
|
| 44 |
-
sys.exit(1)
|
| 45 |
-
|
| 46 |
-
# Run setup if needed
|
| 47 |
-
if not run_setup_if_needed():
|
| 48 |
-
print("Setup failed. Please check the logs.")
|
| 49 |
-
sys.exit(1)
|
| 50 |
-
|
| 51 |
-
# Import and run the app
|
| 52 |
-
try:
|
| 53 |
-
from app import create_interface
|
| 54 |
-
|
| 55 |
-
print("Creating Gradio interface...")
|
| 56 |
-
interface = create_interface()
|
| 57 |
-
|
| 58 |
-
print("Launching interface...")
|
| 59 |
-
interface.launch(
|
| 60 |
-
server_name="0.0.0.0",
|
| 61 |
-
server_port=7860,
|
| 62 |
-
share=False,
|
| 63 |
-
debug=False
|
| 64 |
-
)
|
| 65 |
-
except Exception as e:
|
| 66 |
-
print(f"Error launching interface: {e}")
|
| 67 |
-
sys.exit(1)
|
| 68 |
-
|
| 69 |
-
if __name__ == "__main__":
|
| 70 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|