Closed rumbleFTW closed 1 year ago
Can you provide an example input? @rumbleFTW
Actually I'm not sure. I have a cron-job that uses easygoogletranslate to translate multiple texts, before feeding them to a sentiment analysis-model, about 200+ per day. Here's the code:
from easygoogletranslate import EasyGoogleTranslate
from transformers import pipeline
from typing import *
class SentimentAnalyser:
def __init__(self) -> None:
self.pipe = pipeline(
"text-classification",
model="mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis",
)
self.translator = EasyGoogleTranslate()
def __call__(self, string: str) -> Dict:
return self.pipe(self.translator.translate(text=string, target_language="en"))[
0
]
You can specify the timeout duration. The default timeout duration is 5 seconds, and it seems like it's not enough time to translate your text input. You can override the default timeout duration by defining it like this:
EasyGoogleTranslate(
target_language='en',
timeout=20
)
@rumbleFTW let me know if you have further problems.
@ahmeterenodaci Thanks a lot. Word like a charm! Cheers :)
You're welcome :)
Having this issue for translating Indic languages to english:
Traceback: