danthelion / doc2audiobook

Convert text documents to high fidelity audio(books).
MIT License
204 stars 32 forks source link

Issues with Google Cloud Text-to-Speech API? #3

Open bepuzzled opened 5 years ago

bepuzzled commented 5 years ago

Hello, I am having an error, wheras previously I was able to use your container out of the box.


sudo docker run -v /volume1/homes/doc2audiobook/data:/data:rw -v /volume1/homes/doc2audiobook/.secrets/client_secret.json:/.secrets/client_secret.json:ro doc2audiobook -list-voices
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 54, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/grpc/_channel.py", line 487, in __call__
    return _end_unary_response_blocking(state, call, False, deadline)
  File "/usr/local/lib/python3.6/site-packages/grpc/_channel.py", line 437, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.DEADLINE_EXCEEDED, Deadline Exceeded)>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/google/api_core/retry.py", line 177, in retry_target
    return target()
  File "/usr/local/lib/python3.6/site-packages/google/api_core/timeout.py", line 206, in func_with_timeout
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 56, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "<string>", line 2, in raise_from
google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/code/doc2audiobook/doc2audiobook.py", line 92, in <module>
    main()
  File "/code/doc2audiobook/doc2audiobook.py", line 64, in main
    available_voices = list_voices(client=client)
  File "/code/doc2audiobook/lib/tts_utils.py", line 77, in list_voices
    return [voice.name for voice in client.list_voices().voices]
  File "/usr/local/lib/python3.6/site-packages/google/cloud/texttospeech_v1beta1/gapic/text_to_speech_client.py", line 167, in list_voices
    request, retry=retry, timeout=timeout, metadata=metadata)
  File "/usr/local/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py", line 139, in __call__
    return wrapped_func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/google/api_core/retry.py", line 260, in retry_wrapped_func
    on_error=on_error,
  File "/usr/local/lib/python3.6/site-packages/google/api_core/retry.py", line 195, in retry_target
    last_exc)
  File "<string>", line 2, in raise_from
google.api_core.exceptions.RetryError: Deadline of 600.0s exceeded while calling functools.partial(<function _wrap_unary_errors.<locals>.error_remapped_callable at 0x7f31e9fefe18>, , metadata=[('x-goog-api-client', 'gl-python/3.6.5 gapic/0.1.0 gax/1.1.0 grpc/1.10.1')]), last exception: 504 Deadline Exceeded

It appears the issue is in the interface with the GCP; I refreshed my secrets.json file to no avail. I get the same error with:

sudo docker run \
> -v /volume1/homes/doc2audiobook/data:/data:rw \
> -v /volume1/homes/doc2audiobook/.secrets/client_secret.json:/.secrets/client_secret.json:ro \
> doc2audiobook --voice en-US-Wavenet-A

The input file diagnostics was fine:


docker run -v /volume1/homes/doc2audiobook/data:/data:rw --entrypoint "textract" doc2audiobook /data/input/ship.docx
Turn the ship around, by  L. David Marquet

Penguin Publishing Group

Published February 2017

FOREWORD

I had the opportunity to ride the USS Santa Fe during Captain Marquet’s command tour and observed firsthand the impact of his leadership approach. It had a profound impact on what I thought possible in terms of empowered and engaged workplaces.
danthelion commented 5 years ago

Hey @bepuzzled, sorry for the heavily delayed answer. I'm actually not sure what could have caused this issue and I can't replicate it. Maybe try updating the google-cloud-texttospeech python library, see if that solves anything.