Diff of /src/master.py [000000] .. [8c54ae]

Switch to unified view

a b/src/master.py
1
import argparse
2
import subprocess
3
import os
4
import sys
5
6
def run_scraper():
7
    print("Running the scraper...")
8
    subprocess.run([sys.executable, os.path.join('scraping', 'scraper.py')])
9
10
def run_preprocess():
11
    print("Running the preprocessor...")
12
    subprocess.run([sys.executable, os.path.join('ai', 'preprocess.py')])
13
14
def run_model():
15
    print("Running the model...")
16
    subprocess.run([sys.executable, os.path.join('ai', 'model.py')])
17
18
def run_tests():
19
    print("Running unit tests...")
20
    subprocess.run([sys.executable, '-m', 'unittest', 'discover', '-s', 'ai', '-p', '*_test.py'])
21
22
def main(scrape, preprocess, model, test):
23
    if scrape:
24
        run_scraper()
25
    if preprocess:
26
        run_preprocess()
27
    if model:
28
        run_model()  # Only run the model if specified
29
    if test:
30
        run_tests()
31
32
if __name__ == "__main__":
33
    parser = argparse.ArgumentParser(description="Master program to run scraping, preprocessing, and modeling.")
34
    parser.add_argument('--scrape', action='store_true', help="Run the scraper.")
35
    parser.add_argument('--preprocess', action='store_true', help="Run the preprocessor.")
36
    parser.add_argument('--test', action='store_true', help="Run unit tests.")
37
    
38
    args = parser.parse_args()
39
    
40
    main(args.scrape, args.preprocess, args.test)