|
1 | 1 | """audio transcribe plugin"""
|
2 |
| -import sys, os |
| 2 | +import sys |
3 | 3 | import json
|
4 | 4 | import logging
|
5 | 5 | from pathlib import Path
|
|
8 | 8 | from rb.api.models import (
|
9 | 9 | BatchTextResponse,
|
10 | 10 | DirectoryInput,
|
11 |
| - FileInput, |
12 | 11 | FloatParameterDescriptor,
|
13 | 12 | InputSchema,
|
14 | 13 | InputType,
|
|
21 | 20 | TextParameterDescriptor,
|
22 | 21 | TextResponse,
|
23 | 22 | )
|
24 |
| -from rb.api.models import BatchFileInput |
25 | 23 | from rb.api.models import API_APPMETDATA, API_ROUTES, PLUGIN_SCHEMA_SUFFIX
|
26 | 24 | from rb.api.utils import (
|
27 | 25 | get_int_range_check_func_arg_parser,
|
@@ -190,7 +188,7 @@ def alternate_params_parser(p: str) -> ParameterSchema:
|
190 | 188 | # this fucntion is not used , just an example
|
191 | 189 | try:
|
192 | 190 | params = string_to_dict(p)
|
193 |
| - logger.info(f"-----DEBUG parser ---") |
| 191 | + logger.info("-----DEBUG parser ---") |
194 | 192 | range_object = IntRangeDescriptor(min=params["c"], max=params["d"])
|
195 | 193 | func = get_int_range_check_func_arg_parser(range_object)
|
196 | 194 | if func(params["e"]):
|
@@ -221,15 +219,15 @@ def validate_inputs(inputs: DirInputs):
|
221 | 219 | files = [file for file in dirpath.iterdir() if file.is_file()]
|
222 | 220 | logger.debug(files)
|
223 | 221 | if len(files) < 1:
|
224 |
| - raise HTTPException(status_code=400, detail=f"no 'files_in given directory' for transcribe command") |
| 222 | + raise HTTPException(status_code=400, detail="no 'files_in given directory' for transcribe command") |
225 | 223 | logger.debug("------validate inputs done ---")
|
226 | 224 | ## this return object is now ready for use in transcribe function
|
227 | 225 | return inputs
|
228 | 226 | except (Exception) as e:
|
229 | 227 | logger.error("validate bad inputs: %s", e)
|
230 | 228 | raise HTTPException(status_code=400, detail=f"Invalid path inputs for transcribe command: {e}")
|
231 | 229 |
|
232 |
| -@app.command(f'transcribe') |
| 230 | +@app.command('transcribe') |
233 | 231 | def transcribe(
|
234 | 232 | inputs: Annotated[
|
235 | 233 | DirInputs,
|
|
0 commit comments