Commit f1f51f35 by ‘chizw’

[+]配置更改

1 parent 5bb1fc20
......@@ -108,7 +108,7 @@ if args.hotword_path is not None and os.path.exists(args.hotword_path):
@app.post("/recognition")
async def api_recognition(audio: UploadFile = File(..., description="audio file")):
async def api_recognition(audio: UploadFile = File(..., description="audios file")):
suffix = audio.filename.split(".")[-1]
audio_path = f"{args.temp_dir}/{str(uuid.uuid1())}.{suffix}"
async with aiofiles.open(audio_path, "wb") as out_file:
......
......@@ -96,7 +96,7 @@ async def create_url(param: UrlParam):
if __name__ == "__main__":
log.info("funasr main starting...")
save_path = "../audio/"
save_path = "../audios/"
if os.path.exists(save_path):
shutil.rmtree(save_path)
parser = argparse.ArgumentParser()
......
......@@ -9,7 +9,7 @@ from grpc_client import transcribe_audio_bytes
from paraformer_pb2_grpc import ASRStub
# send the audio data once
# send the audios data once
async def grpc_rec(wav_scp, grpc_uri, asr_user, language):
with grpc.insecure_channel(grpc_uri) as channel:
stub = ASRStub(channel)
......@@ -69,11 +69,11 @@ if __name__ == '__main__':
parser.add_argument("--sample_rate",
type=int,
default=16000,
help="audio sample_rate from client")
help="audios sample_rate from client")
parser.add_argument("--wav_scp",
type=str,
required=True,
help="audio wav scp")
help="audios wav scp")
args = parser.parse_args()
asyncio.run(test(args))
\ No newline at end of file
......@@ -62,7 +62,7 @@ def hello_world():
@app.get("/funasr/")
async def transform_file():
consuming_start_time = time.perf_counter()
res = FunasrService("audio/asr_example.wav").transform()
res = FunasrService("audios/asr_example.wav").transform()
# res = FunasrService("123456.wav").transform()
answer = []
print(str(res[0]["sentence_info"]))
......@@ -89,10 +89,10 @@ async def create_file(file: bytes = File()):
# 打开文件以写入模式
try:
consuming_start_time = time.perf_counter()
save_path = f"./audio/"
save_path = f"audios/"
if not os.path.exists(save_path):
os.mkdir(save_path)
save_path = f"./audio/{str(threading.current_thread().ident)}/"
save_path = f"audios/{str(threading.current_thread().ident)}/"
if not os.path.exists(save_path):
os.mkdir(save_path)
......@@ -136,10 +136,10 @@ async def create_upload_file(file: UploadFile):
try:
consuming_start_time = time.perf_counter()
fn = file.filename
save_path = f"./audio/"
save_path = f"audios/"
if not os.path.exists(save_path):
os.mkdir(save_path)
save_path = f"./audio/{str(threading.current_thread().ident)}/"
save_path = f"audios/{str(threading.current_thread().ident)}/"
if not os.path.exists(save_path):
os.mkdir(save_path)
......@@ -240,7 +240,7 @@ if __name__ == "__main__":
start_kafka()
funasr_producer.send_wait_task()
ap_scheduler_util.scheduler_start()
save_path = "./audio/"
save_path = "audios/"
if os.path.exists(save_path):
shutil.rmtree(save_path)
parser = argparse.ArgumentParser()
......
......@@ -99,7 +99,7 @@ def cli():
# create
parser_create = subparsers.add_parser('create',
help='create dataset by origin audio dirctory: subfix create [modelscope|whisper]')
help='create dataset by origin audios dirctory: subfix create [modelscope|whisper]')
create_subparsers = parser_create.add_subparsers(dest='solution',
help='auto asr solution, modelscope or whisper')
......@@ -161,10 +161,10 @@ def cli():
parser_diarization.add_argument('--top_of_number', default=1, type=int,
help='The n items with the highest frequency of occurrence. Default: 1')
parser_diarization.add_argument('--interval', default=1.0, type=float,
help='The interval between two slice audio. Default: 1.0')
help='The interval between two slice audios. Default: 1.0')
parser_diarization.add_argument("--sample_rate", type=int, default=44100, help="Sample rate, Default: 44100")
parser_diarization.add_argument("--oracle_num", type=int, default=0,
help="oracle number, the person number you think maybe in audio, Default: 0")
help="oracle number, the person number you think maybe in audios, Default: 0")
parser_diarization.set_defaults(func=handle_diarization)
# punctuation
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!