OpenNMT translate string as an input

pytorch

(Negacy Hailu) #1

Is there a ready made version of the translate.py script that takes a string as input instead of a file?

Thanks.


(Guillaume Klein) #2

Are you looking to use a translation server?


(Negacy Hailu) #3

Not exactly, I wanted to call the inference model inside my code.


(Vincent Nguyen) #4

If you look at the code of the server, you will see that we can call the translate object with string rather than path.

so you can do something similar.


(Negacy Hailu) #5

Great, thanks.