本地离线文字翻译Api

Weekly Pick

基于LibreTranslate封装的本地离线文字翻译Api工具,提供Windows预编译exe包,支持多语言翻译,首次下载模型后即可离线使用,适合新手和小白用户。

Check out 本地离线文字翻译Api on CurateClick

• Copy the embed code to showcase this product on your website

• Share on X to spread the word about this amazing tool

开源地址: https://github.com/jianchang512/ott![image](https://github.com/jianchang512/ott/assets/3378335/97ff6814-4480-4238-b37b-62f84c42204d)**功能概述:**支持多语言的本地离线文字翻译Api工具,基于 LibreTranslate 的封装,目的是提供一个容易在本地机器上直接部署的翻译Api服务,无需docker,并提供 Windows 预编译exe包,不必部署,双击可用,方便新手和小白使用。第一次启动需要下载模型,后续即可离线运行.特点:1. windows提供exe编译包,双击即用无需部署2. Mac Linux 提供本机简单部署方式3. 第一次下载模型后即可离线使用Api接口使用假如你部署的地址和端口是 http://127.0.0.1:9911API地址:http://127.0.0.1:9911/translate支持的语言代码: zh=中文简 zt=中文繁 en=英语 fr=法语 de=德语 ja=日语 ko=韩语 ru=俄语 es=西班牙语 th=泰国语 it=意大利语 pt=葡萄牙语 ar=阿拉伯语 tr=土耳其语 hi=印度语请求方法:POST请求数据: q=待翻译文本,source=文本原始语言代码可填auto自动识别,target=要翻译到的目标语言代码返回数据: 返回json数据,正确时 {translatedText:"翻译后结果"},出错时{error:"错误原因"}python requests 请求示例import requestsresult=requests.post("http://127.0.0.1:9911/translate",json={"q":"你好啊我的朋友","source":"zh","target":"en"})print(result.json())# 输出如下{'translatedText': 'Hello, my friend'}# 错误时返回{'error':'错误原因'}Javascripts fetch请求fetch("http://127.0.0.1:9911/translate", { method: "POST", body: JSON.stringify({ q: "Hello!", // 请求翻译的文本 source: "en",//原始语言,或者填写 'auto' 自动检测 target: "zh"//目标语言 }), headers: { "Content-Type": "application/json" }});// 返回json相应{ "translatedText": "你好!" // translatedText 字段中是翻译后的文本}# 错误时返回{'error':'错误原因'}Javascripts jQuery ajax 请求$.post("http://127.0.0.1:9911/translate", { q: "Hello!", // 请求翻译的文本 source: "en",//原始语言,或者填写 'auto' 自动检测 target: "zh"//目标语言 }, function(res){console.log(res) });// 返回json相应{ "translatedText": "你好!" // translatedText 字段中是翻译后的文本}# 错误时返回{'error':'错误原因'}php curl$data = array( 'q' => 'Hello', 'source' => 'auto', 'target' => 'zh'); $json = json_encode($data);$url = 'http://127.0.0.1:9911/translate';$ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");curl_setopt($ch, CURLOPT_POSTFIELDS, $json);curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($json))); $response = curl_exec($ch);if(curl_errno($ch)) { echo 'Error: ' . curl_error($ch);} else { echo $response;}curl_close($ch);#返回{ "translatedText": "你好!" // translatedText 字段中是翻译后的文本}# 错误时返回{'error':'错误原因'}

Latest Weekly Picks

pslscale.com favicon
Weekly Pick

Discover your PSL (Perceived Sexual Market Value) score with our AI-powered facial analysis

MILO

IPYNB to PDF Converter – Free & Secure

lejintian
www.reverie.im favicon
Weekly Pick

Dream It, Chat It, Create It

Louis
make.ink favicon
Weekly Pick

Your AI tattoo generator for pro-grade concepts

Leo Wade
sellfy.com favicon
Weekly Pick

A code-free online store builder to turn views into revenue. Sell digital products, subscriptions, and merch, without fees or hassle.

Maris
www.videotoblog.ai favicon
Weekly Pick

Convert videos into awesome blog posts.

Video To Blog
www.sellerpic.ai favicon
Weekly Pick

SellerPic is the all-in-one AI design platform for e-commerce

SellerPic
fastimage.ai favicon
Weekly Pick

Fast Image AI instantly transforms your photos into stunning styles like Ghibli, Sketch, and Pixar. Effortlessly control image elements and create amazing effects with just one click.

Fast AI Team