Update app.py
Browse files
app.py
CHANGED
|
@@ -4,9 +4,8 @@ MediSync: Multi-Modal Medical Analysis System - Hugging Face Spaces Entry Point
|
|
| 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
|
|
@@ -21,22 +20,31 @@ logger = logging.getLogger(__name__)
|
|
| 21 |
current_dir = Path(__file__).resolve().parent
|
| 22 |
sys.path.append(str(current_dir))
|
| 23 |
|
| 24 |
-
# Import and initialize the
|
| 25 |
try:
|
| 26 |
logger.info("Initializing MediSync for Hugging Face Spaces")
|
| 27 |
-
from mediSync.app import
|
| 28 |
-
|
| 29 |
-
# Create the
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
This file serves as the entry point for Hugging Face Spaces deployment.
|
| 5 |
"""
|
| 6 |
|
|
|
|
|
|
|
| 7 |
import logging
|
| 8 |
+
import sys
|
| 9 |
from pathlib import Path
|
| 10 |
|
| 11 |
# Configure logging
|
|
|
|
| 20 |
current_dir = Path(__file__).resolve().parent
|
| 21 |
sys.path.append(str(current_dir))
|
| 22 |
|
| 23 |
+
# Import and initialize the MediSync app
|
| 24 |
try:
|
| 25 |
logger.info("Initializing MediSync for Hugging Face Spaces")
|
| 26 |
+
from mediSync.app import create_interface
|
| 27 |
+
|
| 28 |
+
# Create the interface - this function creates the MediSyncApp instance internally
|
| 29 |
+
# and returns the Gradio interface
|
| 30 |
+
interface = create_interface()
|
| 31 |
+
|
|
|
|
|
|
|
| 32 |
# For Hugging Face Spaces compatibility
|
| 33 |
app = interface
|
| 34 |
+
|
| 35 |
except Exception as e:
|
| 36 |
logger.error(f"Error initializing MediSync app: {e}")
|
| 37 |
import traceback
|
| 38 |
+
|
| 39 |
logger.error(traceback.format_exc())
|
| 40 |
+
|
| 41 |
+
# Create a fallback interface with error message
|
| 42 |
+
import gradio as gr
|
| 43 |
+
|
| 44 |
+
app = gr.Interface(
|
| 45 |
+
fn=lambda: "MediSync failed to initialize. Please check logs for details.",
|
| 46 |
+
inputs=None,
|
| 47 |
+
outputs=gr.Textbox(),
|
| 48 |
+
title="MediSync Error",
|
| 49 |
+
description=f"Error initializing app: {str(e)}",
|
| 50 |
+
)
|