OpenNMT Forum

Machine Translation Web Interface

You might want to build a GUI for your Machine Translation model to show to a client or to be able to translate sentences online. I have created a simple web interface for OpenNMT which depends on Python Flask and Flask-PageDown libraries. To be able to use the web interface, you need first to implement an OpenNMT Rest API Server as explained by Paul Tardy
at: Simple OpenNMT-py REST server.

You can find the code of the machine translation web interface at:

If you have questions, please let me know.

Kind regards,
Yasmin

3 Likes

Thanks for sharing and will give it a try…

You are welcome, Liu!

aha, good job.
I am doing the same thing with PHP for GUI, and using CURL to connect with the Rest API Server.

But, the point is how to clear/normalize/tokenize the text from the Teaxtare submitted from the UI?

Dear Yaren,

You can choose a tokenizer in the JSON configuration file under the tokenizer part, either sentencepiece or pyonmttok

You can check this post for more details and examples: Simple OpenNMT-py REST server

If something is not covered by the tokenizer, you can apply your own pre-processing code on the text entered in the textarea, and even later your post-processing code on the text received from the translation server. As you know, you can put the text you receive in either cases in a string variable and apply any code on this variable.

I hope this helps.

Kind regards,
Yasmin

I have used and slightly adapted Yasmin’s interface which works very nicely. It’s a great contribution. It can also be seen in action at our free NMT service at www.nmtgateway.com.

Hello Telerence,
For your UI do you have a github account where you have shared the changes you made in building the UI?

Sorry, I didn’t share them personally but I think @ymoslem’s latest version now incorporates them as we have discussed this.

ok, thanks.