接入鬼手剪辑API - 图片翻译

2023-12-05 11:26:24 浏览数 (1)

一、接口介绍

基于文字识别与文本翻译技术,满足用户翻译图片文字的需求。只需要通过调用图片翻译API,传入图片,指定源语言与目标语言,通过POST请求方式,就可以识别图片中的文字并进行翻译。

二、获得AppID、密钥

1.登录鬼手剪辑平台,进入控制台,

2.进入设置,获取自己key、secret

三、

1.定义请求数据结构

根据官方文档中接口调用参数说明定义对应的数据结构

名称

类型

是否必填

说明

srcLang

String

翻译选项--源语言参见:图片翻译支持语种列表示例如下:auto 自动识别源语言en 仅翻译图片内的英文zh 仅翻译图片内的中文(会把中文繁体一起翻译)both 同时翻译图片中的中文和英文th 仅翻译图片中的泰文

tgtLang

String

翻译选项--目标语言参见:图片翻译支持语种列表示例如下:en 翻译为英文zh-hant 翻译为繁体

translateOn

String

是否开启翻译 0否 1是, 默认开启传否表示不进行翻译,仅擦除。开启翻译:不开启翻译,仅自动擦除文字:

downloadInfo

String

JSON Stringjson, 下载所需信息,可提供url"{"url":"https://gc100.cdn.izhaoli.cn/ve_image_translate_task/zhaoli/test_118c08ad-378f-11ee-b49d-3cecefbae932__image.png"}"

synthesisOn

String

是否开启图片合成 0否 1是,合成最终图片, 默认开启

commodityFilterOn

String

是否开启商品文字保护,默认是0不开启,1是开启.当开启时,商品上的文字会被保护,不会被擦除和翻译。如下图所示:开启保护:不开启保护:

callback

String

回调地址url (如果传了回调地址则我方会主动将同获取图片擦除与翻译的处理结果结构一致的JSON数据POST到这个地址)

2.响应参数

支持的语言代码:

代码语言:javascript复制
{
    "zh": {
        "chinese_name": "中文",
        "englsh_name": "Chinese",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "zh-hant": {
        "chinese_name": "中文(繁体)",
        "englsh_name": "Chinese (Traditional)",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "both": {
        "chinese_name": "中英文",
        "englsh_name": "Both Chinese and English",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "en": {
        "chinese_name": "英语",
        "englsh_name": "English",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "auto": {
        "chinese_name": "自动识别",
        "englsh_name": "auto",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ja": {
        "chinese_name": "日语",
        "englsh_name": "Japanese",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ko": {
        "chinese_name": "韩语",
        "englsh_name": "Korean",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "th": {
        "chinese_name": "泰语",
        "englsh_name": "Thai",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "vi": {
        "chinese_name": "越南语",
        "englsh_name": "Vietnamese",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "id": {
        "chinese_name": "印尼语",
        "englsh_name": "Indonesian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "jv": {
        "chinese_name": "印尼-爪哇语",
        "englsh_name": "Indonesian-Javanese",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ms": {
        "chinese_name": "马来语(马来西亚)",
        "englsh_name": "Malay (Malaysian)",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "fil": {
        "chinese_name": "菲律宾语",
        "englsh_name": "Philippines",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "hi": {
        "chinese_name": "印地语",
        "englsh_name": "Hindi",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ru": {
        "chinese_name": "俄语",
        "englsh_name": "Russian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "de": {
        "chinese_name": "德语",
        "englsh_name": "German",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "fr": {
        "chinese_name": "法语",
        "englsh_name": "French",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ar": {
        "chinese_name": "阿拉伯语",
        "englsh_name": "Arabic",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "es": {
        "chinese_name": "西班牙语",
        "englsh_name": "Spanish",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "pt": {
        "chinese_name": "葡萄牙语",
        "englsh_name": "Portuguese",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "it": {
        "chinese_name": "意大利语",
        "englsh_name": "Italy",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "pl": {
        "chinese_name": "波兰语",
        "englsh_name": "Polish",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "da": {
        "chinese_name": "丹麦语",
        "englsh_name": "Danish",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "fi": {
        "chinese_name": "芬兰语",
        "englsh_name": "Finnish",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "km": {
        "chinese_name": "高棉语",
        "englsh_name": "Khmer",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "la": {
        "chinese_name": "拉丁语",
        "englsh_name": "Latin",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "nl": {
        "chinese_name": "荷兰语",
        "englsh_name": "Dutch",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ti": {
        "chinese_name": "藏语",
        "englsh_name": "Tibetan",
        "is_ocr_support": false,
        "is_translate_support": true
    },
    "uy": {
        "chinese_name": "维吾尔语",
        "englsh_name": "Uyghur",
        "is_ocr_support": false,
        "is_translate_support": true
    },
    "ga": {
        "chinese_name": "爱尔兰语",
        "englsh_name": "Irish",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "et": {
        "chinese_name": "爱沙尼亚语",
        "englsh_name": "Estonia",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "sq": {
        "chinese_name": "阿尔巴尼亚语",
        "englsh_name": "Albanian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "az": {
        "chinese_name": "阿塞拜疆语",
        "englsh_name": "Azerbaijan",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "be": {
        "chinese_name": "白俄罗斯语",
        "englsh_name": "Belarus",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "mww": {
        "chinese_name": "白苗语",
        "englsh_name": "Bai Miao",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "bg": {
        "chinese_name": "保加利亚语",
        "englsh_name": "Bulgarian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "eu": {
        "chinese_name": "巴斯克语",
        "englsh_name": "Basque",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "is": {
        "chinese_name": "冰岛语",
        "englsh_name": "Icelandic",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "bs": {
        "chinese_name": "波斯尼亚语",
        "englsh_name": "Bosnian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "fy": {
        "chinese_name": "弗里斯兰语",
        "englsh_name": "Frisian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "jy": {
        "chinese_name": "格鲁吉亚语",
        "englsh_name": "Georgia",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "gu": {
        "chinese_name": "古吉拉特语",
        "englsh_name": "Gujarati",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ht": {
        "chinese_name": "海地克里奥尔语",
        "englsh_name": "Haiti Creole",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ha": {
        "chinese_name": "豪萨语",
        "englsh_name": "Hausa",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "gl": {
        "chinese_name": "加利西亚语",
        "englsh_name": "Galician",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ca": {
        "chinese_name": "加泰罗尼亚语(加泰隆语)",
        "englsh_name": "Catalan",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "cs": {
        "chinese_name": "捷克语",
        "englsh_name": "Czech",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ky": {
        "chinese_name": "吉尔吉斯语(柯尔克孜语)",
        "englsh_name": "Kyrgyz (Kirgiz)",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "otq": {
        "chinese_name": "克雷塔罗奥托米语",
        "englsh_name": "Queretaro Otomi",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "hr": {
        "chinese_name": "克罗地亚语",
        "englsh_name": "Croatian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "co": {
        "chinese_name": "科西嘉语",
        "englsh_name": "Corsican",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ku": {
        "chinese_name": "库尔德语",
        "englsh_name": "Kurdish",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "lv": {
        "chinese_name": "拉脱维亚语",
        "englsh_name": "Latvia",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "lt": {
        "chinese_name": "立陶宛语",
        "englsh_name": "Lithuanian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ro": {
        "chinese_name": "罗马尼亚语",
        "englsh_name": "Romanian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "lb": {
        "chinese_name": "卢森堡语",
        "englsh_name": "Luxembourg",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "rw": {
        "chinese_name": "卢旺达语",
        "englsh_name": "Kinyarwanda",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "mi": {
        "chinese_name": "毛利语",
        "englsh_name": "Maori",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "mg": {
        "chinese_name": "马尔加什语",
        "englsh_name": "Malagasy",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "mt": {
        "chinese_name": "马耳他语",
        "englsh_name": "Maltese",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "mr": {
        "chinese_name": "马拉地语",
        "englsh_name": "Marathi",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ml": {
        "chinese_name": "马拉雅拉姆语",
        "englsh_name": "Malayalam",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "mk": {
        "chinese_name": "马其顿语",
        "englsh_name": "Macedonia",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "mn": {
        "chinese_name": "蒙古语",
        "englsh_name": "Mongolian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "bn": {
        "chinese_name": "孟加拉语",
        "englsh_name": "Bengali",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "my": {
        "chinese_name": "缅甸语",
        "englsh_name": "Burmese",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "af": {
        "chinese_name": "南非荷兰语",
        "englsh_name": "Afrikaans",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "zu": {
        "chinese_name": "南非祖鲁语",
        "englsh_name": "South African Zulu",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ne": {
        "chinese_name": "尼泊尔语",
        "englsh_name": "Nepal",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "no": {
        "chinese_name": "挪威语",
        "englsh_name": "Norwegian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "pa": {
        "chinese_name": "旁遮普语",
        "englsh_name": "Punjabi",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ps": {
        "chinese_name": "普什图语",
        "englsh_name": "Pashto",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "kn": {
        "chinese_name": "卡纳达语",
        "englsh_name": "Kannada",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ny": {
        "chinese_name": "齐切瓦语",
        "englsh_name": "Chichewa",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "sv": {
        "chinese_name": "瑞典语",
        "englsh_name": "Swedish",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "sr": {
        "chinese_name": "塞尔维亚语(拉丁语)",
        "englsh_name": "Serbia (Latin)",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "st": {
        "chinese_name": "塞索托语",
        "englsh_name": "Sesotho",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "sm": {
        "chinese_name": "萨摩亚语",
        "englsh_name": "Samoa",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "eo": {
        "chinese_name": "世界语",
        "englsh_name": "Esperanto",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "sk": {
        "chinese_name": "斯洛伐克语",
        "englsh_name": "Slovak",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "sl": {
        "chinese_name": "斯洛文尼亚语",
        "englsh_name": "Slovenian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "sw": {
        "chinese_name": "斯瓦希里语",
        "englsh_name": "Swahili",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "so": {
        "chinese_name": "索马里语",
        "englsh_name": "Somalia",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "gd": {
        "chinese_name": "苏格兰盖尔语",
        "englsh_name": "Scottish Gaelic",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ceb": {
        "chinese_name": "宿务语",
        "englsh_name": "Cebu language",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "te": {
        "chinese_name": "泰卢固语",
        "englsh_name": "Telugu",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "to": {
        "chinese_name": "汤加语",
        "englsh_name": "Tongan",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "tg": {
        "chinese_name": "塔吉克语",
        "englsh_name": "Tajik",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "tr": {
        "chinese_name": "土耳其语",
        "englsh_name": "Turkey",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "tk": {
        "chinese_name": "土库曼语",
        "englsh_name": "Turkmen",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "cy": {
        "chinese_name": "威尔士语",
        "englsh_name": "Welsh",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ur": {
        "chinese_name": "乌尔都语",
        "englsh_name": "Urdu",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "uk": {
        "chinese_name": "乌克兰语",
        "englsh_name": "Ukraine",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "uz": {
        "chinese_name": "乌兹别克语",
        "englsh_name": "Uzbek",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "haw": {
        "chinese_name": "夏威夷语",
        "englsh_name": "Hawaiian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "hu": {
        "chinese_name": "匈牙利语",
        "englsh_name": "Hungarian",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "sn": {
        "chinese_name": "修纳语",
        "englsh_name": "Shona",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "he": {
        "chinese_name": "希伯来",
        "englsh_name": "Hebrew",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "el": {
        "chinese_name": "希腊语",
        "englsh_name": "Greek",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "su": {
        "chinese_name": "印尼巽他语",
        "englsh_name": "Indonesian-Sundanese",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "ig": {
        "chinese_name": "伊博语",
        "englsh_name": "Igbo",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "yi": {
        "chinese_name": "意第绪语",
        "englsh_name": "Yiddish",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "yua": {
        "chinese_name": "尤卡坦玛雅语",
        "englsh_name": "Yucatan Mayan",
        "is_ocr_support": true,
        "is_translate_support": true
    },
    "yo": {
        "chinese_name": "约鲁巴语",
        "englsh_name": "Yoruba",
        "is_ocr_support": true,
        "is_translate_support": true
    }
}

0 人点赞