-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
72 lines (59 loc) · 1.75 KB
/
run.py
File metadata and controls
72 lines (59 loc) · 1.75 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env python3
"""
GemmaSOS Launcher Script
Simple launcher for the crisis intervention system
"""
import sys
import os
import subprocess
import logging
# Set up logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def check_dependencies():
"""Check if required dependencies are installed"""
required_packages = [
"torch",
"transformers",
"gradio",
"PIL",
"cv2",
"numpy"
]
missing_packages = []
for package in required_packages:
try:
if package == "PIL":
import PIL
elif package == "cv2":
import cv2
else:
__import__(package)
except ImportError:
missing_packages.append(package)
if missing_packages:
logger.error(f"Missing required packages: {', '.join(missing_packages)}")
logger.info("Please install dependencies with: pip install -r requirements.txt")
return False
return True
def main():
"""Main launcher function"""
logger.info("Starting GemmaSOS Crisis Intervention System...")
# Check dependencies
if not check_dependencies():
sys.exit(1)
# Check if main app exists
if not os.path.exists("main_app.py"):
logger.error("main_app.py not found. Please run from the correct directory.")
sys.exit(1)
try:
# Import and run the main application
from main_app import main as run_app
run_app()
except KeyboardInterrupt:
logger.info("Application interrupted by user")
except Exception as e:
logger.error(f"Error running application: {e}")
sys.exit(1)
if __name__ == "__main__":
main()