Spaces:
Runtime error
Runtime error
| import os | |
| import sys | |
| import torch | |
| import subprocess | |
| import logging | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') | |
| logger = logging.getLogger(__name__) | |
| logger.info("="*50) | |
| logger.info("Starting MV3DR Application") | |
| logger.info("="*50) | |
| if not os.path.exists('dust3r/.git'): | |
| logger.info("Initializing dust3r submodule...") | |
| subprocess.run(['git', 'submodule', 'update', '--init', '--recursive'], check=False) | |
| logger.info("Adding dust3r to Python path...") | |
| sys.path.append(os.path.join(os.path.dirname(__file__), 'dust3r')) | |
| logger.info("Importing model initialization module...") | |
| from model import initialize | |
| logger.info("Importing UI builder...") | |
| from gradio_ui import build_ui | |
| logger.info("Importing configuration...") | |
| from config import WEIGHTS_PATH, OUTPUT_DIR | |
| def main(): | |
| logger.info("Creating output directory...") | |
| os.makedirs(OUTPUT_DIR, exist_ok=True) | |
| device = "cuda" if torch.cuda.is_available() else "cpu" | |
| logger.info(f"Using device: {device}") | |
| logger.info("Loading DUSt3R model...") | |
| logger.info(f"Model weights path: {WEIGHTS_PATH}") | |
| model = initialize(WEIGHTS_PATH, device) | |
| logger.info("Model loaded successfully!") | |
| logger.info("Building Gradio UI...") | |
| app = build_ui(OUTPUT_DIR, model, device) | |
| logger.info("UI built successfully!") | |
| logger.info("Launching application...") | |
| app.queue().launch(show_api=False) | |
| logger.info("Application started!") | |
| if __name__ == "__main__": | |
| main() | |