google / making_with_ml

Apache License 2.0
343 stars 189 forks source link

ai_dubs has wrong path on GCS #63

Open anhthoai opened 3 years ago

anhthoai commented 3 years ago

Hello. I tried your command but it always show error : File "dubber.py", line 443, in dub transcripts = get_transcripts_json(os.path.join( File "dubber.py", line 110, in get_transcripts_json res = client.long_running_recognize(config=config, audio=audio).result() File "C:\Users\mrcool\making_with_ml\ai_dubs\venv\lib\site-packages\google\cloud\speech_v1p1beta1\services\speech\client.py", line 457, in long_running_recognize response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) File "C:\Users\mrcool\making_with_ml\ai_dubs\venv\lib\site-packages\google\api_core\gapic_v1\method.py", line 145, in __call__ return wrapped_func(*args, **kwargs) File "C:\Users\mrcool\making_with_ml\ai_dubs\venv\lib\site-packages\google\api_core\grpc_helpers.py", line 59, in error_remapped_callable six.raise_from(exceptions.from_grpc_error(exc), exc) File "<string>", line 3, in raise_from google.api_core.exceptions.InvalidArgument: 400 Invalid recognition 'config': Bad language code.

shubham8550 commented 1 year ago

set your command in this order not from readme order

    videoFile (String): File to dub
    outputDir (String): Directory to write output files
    srcLang (String): Language code to translate from (i.e. "fi")
    targetLangs (list, optional): Languages to translate too, i.e. ["en", "fr"]
    storageBucket (String, optional): GCS bucket for temporary file storage. Defaults to None.
    phraseHints (list, optional): "Hints" for words likely to appear in audio. Defaults to [].
    dubSrc (bool, optional): Whether to generate dubs in the source language. Defaults to False.
    speakerCount (int, optional): How many speakers in the video. Defaults to 1.
    voices (dict, optional): Which voices to use for dubbing, i.e. {"en": "en-AU-Standard-A"}. Defaults to {}.
    srt (bool, optional): Path of SRT transcript file, if it exists. Defaults to False.
    newDir (bool, optional): Whether to start dubbing from scratch or use files in outputDir. Defaults to False.
    genAudio (bool, optional): Generate new audio, even if it's already been generated. Defaults to False.
    noTranslate (bool, optional): Don't translate. Defaults to False.

example

python dubber.py sample.mp4 outputDir "hi" --targetLangs '["ja",]'

shubham8550 commented 1 year ago

for GCS error u can use this

    # transcripts = get_transcripts_json(os.path.join(
    #     "gs://", storageBucket, tmpFile), srcLang,
    #     phraseHints=phraseHints,
    #     speakerCount=speakerCount)
    transcripts = get_transcripts_json(
        "gs://"+ storageBucket+"/"+ tmpFile, srcLang,
        phraseHints=phraseHints,
        speakerCount=speakerCount)