script.py 472 B

12345678910111213141516171819202122
  1. from googletrans import Translator
  2. translator = Translator()
  3. params = {
  4. "language string": "ja",
  5. }
  6. def input_modifier(string):
  7. """
  8. This function is applied to your text inputs before
  9. they are fed into the model.
  10. """
  11. return translator.translate(string, dest='en').text
  12. def output_modifier(string):
  13. """
  14. This function is applied to the model outputs.
  15. """
  16. return translator.translate(string, dest=params['language string']).text