ahmetoner / whisper-asr-webservice

OpenAI Whisper ASR Webservice API
https://ahmetoner.github.io/whisper-asr-webservice
MIT License
1.99k stars 358 forks source link

The value of the vad_filter was not determined. #179

Closed leoterry-ulrica closed 9 months ago

leoterry-ulrica commented 9 months ago

app/faster_whisper/core.py This file contains a judgment logic error!The value of the vad_filter was not determined.

def transcribe(
        audio,
        task: Union[str, None],
        language: Union[str, None],
        initial_prompt: Union[str, None],
        vad_filter: Union[bool, None],
        word_timestamps: Union[bool, None],
        output,
):
    options_dict = {"task": task}
    if language:
        options_dict["language"] = language
    if initial_prompt:
        options_dict["initial_prompt"] = initial_prompt
    if word_timestamps:
        options_dict["vad_filter"] = True
    if word_timestamps:
        options_dict["word_timestamps"] = True
    with model_lock:
leoterry-ulrica commented 9 months ago

@ahmetoner

ahmetoner commented 9 months ago

Thank you for reporting. I'll be releasing a patch soon.

leoterry-ulrica commented 9 months ago

Thank you for reporting. I'll be releasing a patch soon.

When the ASR interface receives the parameter language=zh and the output format is set to json, the returned text is encoded in Unicode.I need to return the Chinese text directly.

Python, a high level interpreted programming language, famous for its zen-like code.It's arguably the most popular language in the world because it's easy to learn, yet practical for serious projects.In fact, you're watching this YouTube video in a Python web application right now.It was created by Guido van Rossum and released in 1991, who named it after Monty Python's Flying Circus.Which is why you'll sometimes find spam and eggs instead of foo and bar in code samples.\u5b83\u7528\u4e8e\u5728\u6d4b\u8bd5\u5668\u4e0a\u5efa\u9020\u5e94\u7528\u4f18\u79c0\u7684\u5e94\u7528\u7a0b\u5e8f\u4f8b\u5982Jango\u305d\u308c\u7b49\u7f51\u8def\u5e94\u7528\u7a0b\u5e8f\u5b83\u4ea6\u662f\u5927\u6570\u636e\u5206\u6790\u548c\u8ba1\u7b97\u7684\u9009\u533a\u8bb8\u591a\u5b66\u751f\u4f1a\u9009\u7528Python\u4ee5\u4e3a\u5b66\u4e60\u6587\u5b57\u56e0\u4e3a\u5b83\u7684\u8bfe\u7a0b\u63a7\u5236\u7740\u8bfb\u529b\u5982Python\u7684Zen\u6240\u663e\u793a\u7684\u7f8e\u4e3d\u6bd4\u6c61\u3064\u304d\u800c\u5434\u4faf\u6bd4\u4e0d\u9b44\u3064\u304dPython\u975e\u5e38\u7b80\u5355\u4f46\u5b83\u5c11\u6709\u9ebb\u70e6\u52a8\u7528\u5e7b\u601c\u7684\u9b54\u672f\u5176\u6587\u5b57\u7ecf\u5e38\u7edf\u7edf\u7ec4\u6210\u5237\u672c WHOLE COUNTRY ALLOWS US TO EXECUTE AND DOCUMENT THE WE'RE CURRENTLY AT VERSION 3 OF THE LANGUAGEAND YOU CAN GET STARTED BY CREATING A FILE THAT ENDS IN .PYOR .IPYMB TO CREATE AN INTERACTIVE NOTEBOOKCREATE A VARIABLE BY SETTING A NAME EQUAL TO A VALUEIT'S STRONGLY TYPED WHICH MEANS VALUES WON'T CHANGE IN UNEXPECTED WAYSBUT DYNAMIC SO TYPE ANOTATIONS ARE NOT REQUIREDTHE SYNTAX IS HIGHLY EFFICIENTALLOWING YOU TO DECLARE MULTIPLE VARIABLES ON A SINGLE LINE\u4e26\u5b9a\u7fa9\u8a18\u3001\u540d\u5b57\u3001\u8a5e\u4e32\u548c\u5b57\u7b26 ihrer reigns with literal syntax\u4e0d\u80fd\u7528 semicolon\u5982\u679c\u4f7f\u7528\u5b83\u5011\u800c\u4f60\u9ad4\u9a57Pythonista\u4e26\u4e0d\u6703\u8aaa\u4f60\u7684 Code \u662f\u975ePythonic\u800c\u4e0d\u662f semicolonPython \u6703\u4f7f\u7528 poultice\u4f86\u5b9a\u7fa9\u4e00\u884c\u7684\u985e\u578b\u5b9a\u7fa9\u4e00\u9805\u529f\u80fd\u7528DEF \u53bb\u5b9a\u7fa9\u518d\u7528 Next line\u901a\u5e38\u7528 For spaces\u4f86\u5b9a\u7fa9\u9019\u500b\u529f\u80fd\u7684\u8eab\u9ad4\u6211\u5011\u4e5f\u6703\u7528 For loop\u518d\u7528 For spaces\u9019\u662f\u6703\u5fc5\u9808\u53e6\u7528Curly braces \u548c semicolon\u5728\u5176\u4ed6\u8a9e\u8a00\u4e2d\u8a8d\u5b9a\u7684Python\u662f\u4e00\u7a2e\u591a\u500b\u8a9e\u8a00\u8a9e\u8a00\u6211\u5011\u53ef\u4ee5\u4f7f\u7528\u6a5f\u5668\u6a21\u5f0f\u4f7f\u7528 lambda \u314e\u314e\u4e5f\u4f7f\u7528\u7269\u9ad4\u4f5c\u70ba\u6578\u64da\u4ee5\u4f7f\u7528\u7269\u9ad4\u4e3b\u5c0e\u6a21\u5f0f\u4f8b\u5982\u5f9e\u4e8b\u8005\u53ca\u627f\u8afe\u4e5f\u6709\u7b2c\u4e09\u65b9\u66f8\u7c4d\u7684\u8a2d\u8a08\u6bd4\u5982Tensor Flow\u4e5f\u6709\u591a\u500b\u9ad8\u6548\u7387\u3001\u4f4e\u968e\u7248\u672c\u5c31\u5982 Open Computer Vision\u901a\u5e38\u90fd\u7528Pip application manager\u9019\u662f100\u79d2\u5f8c\u7684Python\u540d\u5b57\u8a9e\u8a00\u8a9e\u70b9\u8d5e,\u5982\u679c\u4f60\u60f3\u770b\u5230\u66f4\u591a\u8fd9\u6837\u7684\u77ed\u7247,\u8c22\u8c22\u89c2\u770b,\u6211\u4eec\u4e0b\u671f\u89c1
leoterry-ulrica commented 9 months ago

Thank you for reporting. I'll be releasing a patch soon.

When the ASR interface receives the parameter language=zh and the output format is set to json, the returned text is encoded in Unicode.I need to return the Chinese text directly.

Python, a high level interpreted programming language, famous for its zen-like code.It's arguably the most popular language in the world because it's easy to learn, yet practical for serious projects.In fact, you're watching this YouTube video in a Python web application right now.It was created by Guido van Rossum and released in 1991, who named it after Monty Python's Flying Circus.Which is why you'll sometimes find spam and eggs instead of foo and bar in code samples.\u5b83\u7528\u4e8e\u5728\u6d4b\u8bd5\u5668\u4e0a\u5efa\u9020\u5e94\u7528\u4f18\u79c0\u7684\u5e94\u7528\u7a0b\u5e8f\u4f8b\u5982Jango\u305d\u308c\u7b49\u7f51\u8def\u5e94\u7528\u7a0b\u5e8f\u5b83\u4ea6\u662f\u5927\u6570\u636e\u5206\u6790\u548c\u8ba1\u7b97\u7684\u9009\u533a\u8bb8\u591a\u5b66\u751f\u4f1a\u9009\u7528Python\u4ee5\u4e3a\u5b66\u4e60\u6587\u5b57\u56e0\u4e3a\u5b83\u7684\u8bfe\u7a0b\u63a7\u5236\u7740\u8bfb\u529b\u5982Python\u7684Zen\u6240\u663e\u793a\u7684\u7f8e\u4e3d\u6bd4\u6c61\u3064\u304d\u800c\u5434\u4faf\u6bd4\u4e0d\u9b44\u3064\u304dPython\u975e\u5e38\u7b80\u5355\u4f46\u5b83\u5c11\u6709\u9ebb\u70e6\u52a8\u7528\u5e7b\u601c\u7684\u9b54\u672f\u5176\u6587\u5b57\u7ecf\u5e38\u7edf\u7edf\u7ec4\u6210\u5237\u672c WHOLE COUNTRY ALLOWS US TO EXECUTE AND DOCUMENT THE WE'RE CURRENTLY AT VERSION 3 OF THE LANGUAGEAND YOU CAN GET STARTED BY CREATING A FILE THAT ENDS IN .PYOR .IPYMB TO CREATE AN INTERACTIVE NOTEBOOKCREATE A VARIABLE BY SETTING A NAME EQUAL TO A VALUEIT'S STRONGLY TYPED WHICH MEANS VALUES WON'T CHANGE IN UNEXPECTED WAYSBUT DYNAMIC SO TYPE ANOTATIONS ARE NOT REQUIREDTHE SYNTAX IS HIGHLY EFFICIENTALLOWING YOU TO DECLARE MULTIPLE VARIABLES ON A SINGLE LINE\u4e26\u5b9a\u7fa9\u8a18\u3001\u540d\u5b57\u3001\u8a5e\u4e32\u548c\u5b57\u7b26 ihrer reigns with literal syntax\u4e0d\u80fd\u7528 semicolon\u5982\u679c\u4f7f\u7528\u5b83\u5011\u800c\u4f60\u9ad4\u9a57Pythonista\u4e26\u4e0d\u6703\u8aaa\u4f60\u7684 Code \u662f\u975ePythonic\u800c\u4e0d\u662f semicolonPython \u6703\u4f7f\u7528 poultice\u4f86\u5b9a\u7fa9\u4e00\u884c\u7684\u985e\u578b\u5b9a\u7fa9\u4e00\u9805\u529f\u80fd\u7528DEF \u53bb\u5b9a\u7fa9\u518d\u7528 Next line\u901a\u5e38\u7528 For spaces\u4f86\u5b9a\u7fa9\u9019\u500b\u529f\u80fd\u7684\u8eab\u9ad4\u6211\u5011\u4e5f\u6703\u7528 For loop\u518d\u7528 For spaces\u9019\u662f\u6703\u5fc5\u9808\u53e6\u7528Curly braces \u548c semicolon\u5728\u5176\u4ed6\u8a9e\u8a00\u4e2d\u8a8d\u5b9a\u7684Python\u662f\u4e00\u7a2e\u591a\u500b\u8a9e\u8a00\u8a9e\u8a00\u6211\u5011\u53ef\u4ee5\u4f7f\u7528\u6a5f\u5668\u6a21\u5f0f\u4f7f\u7528 lambda \u314e\u314e\u4e5f\u4f7f\u7528\u7269\u9ad4\u4f5c\u70ba\u6578\u64da\u4ee5\u4f7f\u7528\u7269\u9ad4\u4e3b\u5c0e\u6a21\u5f0f\u4f8b\u5982\u5f9e\u4e8b\u8005\u53ca\u627f\u8afe\u4e5f\u6709\u7b2c\u4e09\u65b9\u66f8\u7c4d\u7684\u8a2d\u8a08\u6bd4\u5982Tensor Flow\u4e5f\u6709\u591a\u500b\u9ad8\u6548\u7387\u3001\u4f4e\u968e\u7248\u672c\u5c31\u5982 Open Computer Vision\u901a\u5e38\u90fd\u7528Pip application manager\u9019\u662f100\u79d2\u5f8c\u7684Python\u540d\u5b57\u8a9e\u8a00\u8a9e\u70b9\u8d5e,\u5982\u679c\u4f60\u60f3\u770b\u5230\u66f4\u591a\u8fd9\u6837\u7684\u77ed\u7247,\u8c22\u8c22\u89c2\u770b,\u6211\u4eec\u4e0b\u671f\u89c1

I have already solved the problem:Set the value of ensure_ascii to False. ensure_ascii=False

class WriteJSON(ResultWriter):
    extension: str = "json"

    def write_result(self, result: dict, file: TextIO):
        json.dump(result, file,ensure_ascii=False)