You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For translate mode, I think it was optimized for doing batch translations and I can say it is already fast for that use case. The problem is if I just wanted to translate 1 sentence, it takes the same time to process a batch of statements.
Feature wanted:
I wish there is a mode like the google translate api where in I could input a single statement and it will return the corresponding translation of that sentence almost instantly.
**I may be wrong so if this feature is already present, I'd appreciate it if you'd comment it here so I could close the issue.
The text was updated successfully, but these errors were encountered:
from google.cloud import translate
def translate_text(text,target='en'):
"""
Target must be an ISO 639-1 language code.
https://cloud.google.com/translate/docs/languages
"""
translate_client = translate.Client()
result = translate_client.translate(
text,
target_language=target)
print(u'Text: {}'.format(result['input']))
print(u'Translation: {}'.format(result['translatedText']))
print(u'Detected source language: {}'.format(
result['detectedSourceLanguage']))
example_text ="Hola saludos"
translate_text(example_text.decode('utf-8'),target='en')
### OUTPUT ###
"""
Text: Hola saludos
Translation: Hello greetings
Detected source language: es
"""
Issue with current translation: Upon checking the code, it seems like the Estimator.predict() causes the inference to slow down for a single query since it needs to create a graph for each prediction.
For translate mode, I think it was optimized for doing batch translations and I can say it is already fast for that use case. The problem is if I just wanted to translate 1 sentence, it takes the same time to process a batch of statements.
Feature wanted:
I wish there is a mode like the google translate api where in I could input a single statement and it will return the corresponding translation of that sentence almost instantly.
**I may be wrong so if this feature is already present, I'd appreciate it if you'd comment it here so I could close the issue.
The text was updated successfully, but these errors were encountered: