Spaces:
Sleeping
Sleeping
Add debug logging to diagnose import issue
Browse files
app.py
CHANGED
|
@@ -6,9 +6,6 @@ import os
|
|
| 6 |
import sys
|
| 7 |
import logging
|
| 8 |
|
| 9 |
-
# Setup Python path
|
| 10 |
-
sys.path.insert(0, os.path.dirname(__file__))
|
| 11 |
-
|
| 12 |
# Configure logging for Hugging Face
|
| 13 |
logging.basicConfig(
|
| 14 |
level=logging.INFO,
|
|
@@ -17,8 +14,30 @@ logging.basicConfig(
|
|
| 17 |
|
| 18 |
logger = logging.getLogger(__name__)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# Import after path setup
|
|
|
|
| 21 |
from src.api.server import AnalysisServer
|
|
|
|
| 22 |
|
| 23 |
def main():
|
| 24 |
"""Launch the Gradio interface for Hugging Face Spaces"""
|
|
|
|
| 6 |
import sys
|
| 7 |
import logging
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
# Configure logging for Hugging Face
|
| 10 |
logging.basicConfig(
|
| 11 |
level=logging.INFO,
|
|
|
|
| 14 |
|
| 15 |
logger = logging.getLogger(__name__)
|
| 16 |
|
| 17 |
+
# Debug: Print current directory and Python path
|
| 18 |
+
logger.info(f"Current working directory: {os.getcwd()}")
|
| 19 |
+
logger.info(f"__file__ location: {os.path.abspath(__file__)}")
|
| 20 |
+
logger.info(f"Python path: {sys.path}")
|
| 21 |
+
|
| 22 |
+
# Setup Python path
|
| 23 |
+
app_dir = os.path.dirname(os.path.abspath(__file__))
|
| 24 |
+
sys.path.insert(0, app_dir)
|
| 25 |
+
logger.info(f"Added to Python path: {app_dir}")
|
| 26 |
+
|
| 27 |
+
# Debug: Check if src directory exists
|
| 28 |
+
src_dir = os.path.join(app_dir, 'src')
|
| 29 |
+
logger.info(f"src directory exists: {os.path.exists(src_dir)}")
|
| 30 |
+
if os.path.exists(src_dir):
|
| 31 |
+
logger.info(f"src contents: {os.listdir(src_dir)}")
|
| 32 |
+
models_dir = os.path.join(src_dir, 'models')
|
| 33 |
+
logger.info(f"src/models exists: {os.path.exists(models_dir)}")
|
| 34 |
+
if os.path.exists(models_dir):
|
| 35 |
+
logger.info(f"src/models contents: {os.listdir(models_dir)}")
|
| 36 |
+
|
| 37 |
# Import after path setup
|
| 38 |
+
logger.info("Attempting to import AnalysisServer...")
|
| 39 |
from src.api.server import AnalysisServer
|
| 40 |
+
logger.info("Successfully imported AnalysisServer!")
|
| 41 |
|
| 42 |
def main():
|
| 43 |
"""Launch the Gradio interface for Hugging Face Spaces"""
|