SmartHeal commited on
Commit
2db03e8
·
verified ·
1 Parent(s): abdcfa7

Update app.py

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