Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
MediSync: Multi-Modal Medical Analysis System - Hugging Face Spaces Entry Point
|
| 3 |
+
==============================================================================
|
| 4 |
+
This file serves as the entry point for Hugging Face Spaces deployment.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import sys
|
| 8 |
+
import os
|
| 9 |
+
import logging
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
# Configure logging
|
| 13 |
+
logging.basicConfig(
|
| 14 |
+
level=logging.INFO,
|
| 15 |
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
| 16 |
+
handlers=[logging.StreamHandler()],
|
| 17 |
+
)
|
| 18 |
+
logger = logging.getLogger(__name__)
|
| 19 |
+
|
| 20 |
+
# Add the current directory to Python path
|
| 21 |
+
current_dir = Path(__file__).resolve().parent
|
| 22 |
+
sys.path.append(str(current_dir))
|
| 23 |
+
|
| 24 |
+
# Import and initialize the MediSyncApp
|
| 25 |
+
try:
|
| 26 |
+
logger.info("Initializing MediSync for Hugging Face Spaces")
|
| 27 |
+
from mediSync.app import MediSyncApp
|
| 28 |
+
|
| 29 |
+
# Create the app instance
|
| 30 |
+
app_instance = MediSyncApp()
|
| 31 |
+
|
| 32 |
+
# Create the interface
|
| 33 |
+
interface = app_instance.create_ui()
|
| 34 |
+
|
| 35 |
+
# For Hugging Face Spaces compatibility
|
| 36 |
+
app = interface
|
| 37 |
+
|
| 38 |
+
except Exception as e:
|
| 39 |
+
logger.error(f"Error initializing MediSync app: {e}")
|
| 40 |
+
import traceback
|
| 41 |
+
logger.error(traceback.format_exc())
|
| 42 |
+
raise
|