-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
26 lines (22 loc) · 843 Bytes
/
main.py
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
from loguru import logger
from src.watcher import start_watching
from src.config import settings
from src.extractor import SafetyNotesExtractor
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--force-cpu', action='store_true', help='Force CPU usage instead of GPU')
args = parser.parse_args()
logger.info("Starting Safety Notes Extractor...")
logger.info(f"Watching directory: {settings.INPUT_DIR}")
logger.info(f"Output directory: {settings.OUTPUT_DIR}")
try:
extractor = SafetyNotesExtractor(force_cpu=args.force_cpu)
start_watching(extractor=extractor)
except KeyboardInterrupt:
logger.info("Shutting down...")
except Exception as e:
logger.error(f"Fatal error: {str(e)}")
raise
if __name__ == "__main__":
main()