@@ -56,16 +56,17 @@ def fetch(config):
5656 type = str ,
5757 callback = pipeline_filepath_validator ,
5858)
59- @click .option (
60- '--config' ,
61- help = 'Which ML model to use for inference' ,
62- default = None ,
63- type = click .Choice (['usgs' ]),
64- )
59+ # @click.option(
60+ # '--config',
61+ # help='Which ML model to use for inference',
62+ # default=None,
63+ # type=click.Choice(['usgs']),
64+ # )
6565@click .option (
6666 '--output' ,
67- help = 'Path to output JSON (if unspecified, results are printed to screen)' ,
68- default = None ,
67+ 'output_path' ,
68+ help = 'Path to output folder for the results' ,
69+ default = '.' ,
6970 type = str ,
7071)
7172# @click.option(
@@ -76,45 +77,21 @@ def fetch(config):
7677# )
7778def pipeline (
7879 filepath ,
79- config ,
80- output ,
80+ # config,
81+ output_path ,
8182 # classifier_thresh,
8283):
83- """
84- Run the BatBot pipeline on an input WAV filepath. An example output of the JSON
85- can be seen below.
86-
87- .. code-block:: javascript
8884
89- {
90- '/path/to/file.wav': {
91- 'classifier': 0.5,
92- }
93- }
94- """
95- if config is not None :
96- config = config .strip ().lower ()
97- # classifier_thresh /= 100.0
85+ # define out file stem using given output folder
86+ out_file_stem = join (output_path , splitext (basename (filepath ))[0 ])
9887
99- score = batbot .pipeline (
88+ batbot .pipeline (
10089 filepath ,
101- config = config ,
90+ # config=config,
10291 # classifier_thresh=classifier_thresh,
92+ out_file_stem = out_file_stem ,
10393 )
10494
105- data = {
106- filepath : {
107- 'classifier' : score ,
108- }
109- }
110-
111- log .debug ('Outputting results...' )
112- if output :
113- with open (output , 'w' ) as outfile :
114- json .dump (data , outfile , indent = 4 )
115- else :
116- print (data )
117-
11895
11996@click .command ('preprocess' )
12097@click .argument (
0 commit comments