Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,573 Bytes
0249388 2db03e8 0249388 2db03e8 0249388 2db03e8 0249388 2db03e8 0249388 55faf5f 0249388 55faf5f 0249388 55faf5f 0249388 55faf5f af3c3f8 0249388 55faf5f 0249388 55faf5f 0249388 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
#!/usr/bin/env python3
import os
import logging
import traceback
import gradio as gr
import spaces
# Import internal modules
from src.config import Config
from src.database import DatabaseManager
from src.auth import AuthManager
from src.ai_processor import AIProcessor
from src.ui_components_original import UIComponents
# Logging setup
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
class SmartHealApp:
def __init__(self):
self.ui_components = None
try:
self.config = Config()
self.database_manager = DatabaseManager(self.config.get_mysql_config())
self.auth_manager = AuthManager(self.database_manager)
self.ai_processor = AIProcessor()
self.ui_components = UIComponents(
self.auth_manager,
self.database_manager,
self.ai_processor
)
logging.info("✅ SmartHeal App initialized successfully.")
except Exception as e:
logging.error(f"Initialization error: {e}")
traceback.print_exc()
raise
def launch(self, port=7860, share=True):
interface = self.ui_components.create_interface()
interface.launch(
share=share
)
def main():
try:
app = SmartHealApp()
app.launch()
except KeyboardInterrupt:
logging.info("App interrupted by user.")
except Exception:
logging.error("App failed to start.")
raise
if __name__ == "__main__":
main() |