Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix retract error #1350

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions runtime/python/http/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import uuid

import aiofiles
import ffmpeg
import uvicorn
from fastapi import FastAPI, File, UploadFile
from modelscope.utils.logger import get_logger
Expand Down Expand Up @@ -105,7 +106,6 @@
app = FastAPI(title="FunASR")

param_dict = {"sentence_timestamp": True, "batch_size_s": 300}

if args.hotword_path is not None and os.path.exists(args.hotword_path):
with open(args.hotword_path, 'r', encoding='utf-8') as f:
lines = f.readlines()
Expand All @@ -122,8 +122,7 @@ async def api_recognition(audio: UploadFile = File(..., description="audio file"
async with aiofiles.open(audio_path, 'wb') as out_file:
content = await audio.read()
await out_file.write(content)

try:
try:
audio_bytes, _ = (
ffmpeg.input(audio_path, threads=0)
.output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=16000)
Expand Down Expand Up @@ -152,6 +151,5 @@ async def api_recognition(audio: UploadFile = File(..., description="audio file"
return {"msg": "未知错误", "code": -1}



if __name__ == '__main__':
uvicorn.run(app, host=args.host, port=args.port, ssl_keyfile=args.keyfile, ssl_certfile=args.certfile)
Loading