# machinebee **Repository Path**: mycharm/machinebee ## Basic Information - **Project Name**: machinebee - **Description**: 构建本地的翻译工具,我们实际上采用的是抱抱脸开源的transformers实现的翻译服务,具体效果可以参考相关文档和数据。 - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-07 - **Last Updated**: 2023-11-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Machine Translation Service Translation flask API for the Helsinki NLP models available in the [Huggingface Transformers library](https://huggingface.co/Helsinki-NLP). ## Usage You can download language models using the command line utility. For example... ``` cd machine-translation-service mkdir data python download_models.py --source zh --target en python download_models.py --source en --target zh python download_models.py --source en --target fr ``` To run with Python>=3.6: ``` pip install -r requirements.txt python app.py ``` To run with docker: ``` docker build -t machine-translation-service . docker run -p 5000:5000 -v $(pwd)/data:/app/data -it machine-translation-service ``` The front end should then become available at http://localhost:5000. Call the service with curl: ``` curl --location --request POST 'http://localhost:5000/translate' \ --header 'Content-Type: application/json' \ -d '{ "text":"hello", "source":"en", "target":"fr" }' ```