inference.mlcube

MLCube Handler File

 1"""
 2### MLCube Handler File
 3"""
 4
 5
 6import os 
 7os.environ["MKL_SERVICE_FORCE_INTEL"] = '1'  # see issue #152
 8import typer
 9import os
10
11app = typer.Typer()
12
13
14@app.command("infer")
15def infer(
16    data_path: str = typer.Option(..., "--data_path"),
17    output_path: str = typer.Option(..., "--output_path"),
18):
19    TASK_NAME = "BraTS-PED"
20    if TASK_NAME == "BraTS-SSA":
21        import runner_ssa as runner
22    elif TASK_NAME == "BraTS-PED":
23        import runner_ped as runner
24
25    runner.setup_model_weights()
26    runner.batch_processor(data_path, output_path)
27    return output_path
28
29@app.command("hotfix")
30def hotfix():
31    # NOOP command for typer to behave correctly. DO NOT REMOVE OR MODIFY
32    pass
33
34
35if __name__ == "__main__":
36    app()
app = <typer.main.Typer object>
@app.command('infer')
def infer( data_path: str = <typer.models.OptionInfo object>, output_path: str = <typer.models.OptionInfo object>):
15@app.command("infer")
16def infer(
17    data_path: str = typer.Option(..., "--data_path"),
18    output_path: str = typer.Option(..., "--output_path"),
19):
20    TASK_NAME = "BraTS-PED"
21    if TASK_NAME == "BraTS-SSA":
22        import runner_ssa as runner
23    elif TASK_NAME == "BraTS-PED":
24        import runner_ped as runner
25
26    runner.setup_model_weights()
27    runner.batch_processor(data_path, output_path)
28    return output_path
@app.command('hotfix')
def hotfix():
30@app.command("hotfix")
31def hotfix():
32    # NOOP command for typer to behave correctly. DO NOT REMOVE OR MODIFY
33    pass