-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Speech: long_running_recognize on serverless #6162
Comments
@jdupl123 You could dump the state of the future = speech_client.long_running_recognize(...)
opration = future.operation()
# save the message in your backing store of choice Then you could reconstitute it later: from google.api_core.operation import from_gapic
from google.cloud.speech_v1.proto import cloud_speech_pb2
# load operation from backing store
future = from_gapic(
operation,
speech_client.transport._operations_client,
cloud_speech_pb2.LongRunningRecognizeResponse,
metadata_type=cloud_speech_pb2.LongRunningRecognizeMetadata,
) |
thanks @tseaver for the tip. since future.operation is of type google.longrunning.operations_pb2.Operation I can't just JSON dump it, to save it in Redis. would you recommend pickle.dumps() or is there some better way to convert the operation to text and back again. I always have some security concerns around using pickle. |
btw I tried saving the name:"1234324" printed out by |
@jdupl123 Convert a protobuf messages to JSON: from google.protobuf import json_format
# Convert operation protobuf message to JSON-formatted string
operation_json = json_format.MessageToJson(operation) Converting it back: from google.longrunning import operation_pb2
# Convert JSON-formatted string to proto message
new_operation = json_format.Parse(operation_js, operation_pb2.Operation()) |
Many thanks @tseaver much appreciated. |
I've tried the above but I run into the following issue. code as follows
any ideas of tips for how to debug this further? @tseaver |
I solved this issue. the issue was mixing speech_v1 with speech_v1p1beta1 |
@tseaver this method works for me most of the time but occasionally I get
this happens when there is a noise of silence at the end of the file to be transcribed. Any ideas what may be causing this? |
I asked this on stackoverflow https://stackoverflow.com/questions/52417481/speech-long-running-recognize-on-serverless but recieved no response.
I would like to use long_running_recognize with on serverless. I have a constraint that I can only run for 5 minutes at a time. In order to gather a transcription which takes longer than 5 minutes, I would like to resume the operation.result call in a new process.
I could implement my own client but this is not an ideal solution as it requires me calling
to get an access token. It also make it harder to keep up with changes in the api.
Any advice/thoughts would be apreciated.
Cheers,
Jaco.
The text was updated successfully, but these errors were encountered: