2023-08-27 21:53:49 +05:30
|
|
|
{
|
|
|
|
"swagger": "2.0",
|
|
|
|
"info": {
|
|
|
|
"contact": {}
|
|
|
|
},
|
|
|
|
"paths": {
|
2023-10-25 18:39:31 +05:30
|
|
|
"/api/engines": {
|
|
|
|
"get": {
|
|
|
|
"description": "Lists available Engines.",
|
|
|
|
"summary": "List engines",
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "OK",
|
|
|
|
"schema": {
|
|
|
|
"type": "object",
|
|
|
|
"additionalProperties": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2024-04-14 18:41:18 +05:30
|
|
|
"/api/image": {
|
|
|
|
"post": {
|
|
|
|
"description": "When engine is set to all, it will return an array of libmozhi.LangOut.",
|
|
|
|
"summary": "Translate an image",
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Engine name",
|
|
|
|
"name": "engine",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Source language",
|
|
|
|
"name": "from",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Target language",
|
|
|
|
"name": "to",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "PNG image in base64 format",
|
|
|
|
"name": "image",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
|
|
|
"description": "OK",
|
|
|
|
"schema": {
|
|
|
|
"$ref": "#/definitions/libmozhi.ImgOut"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-08-27 21:53:49 +05:30
|
|
|
"/api/source_languages": {
|
|
|
|
"get": {
|
|
|
|
"summary": "Show list of available source languages for engine",
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Engine name",
|
|
|
|
"name": "engine",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
2023-09-11 09:15:41 +05:30
|
|
|
"description": "OK",
|
2023-08-27 21:53:49 +05:30
|
|
|
"schema": {
|
2023-09-11 09:15:41 +05:30
|
|
|
"$ref": "#/definitions/libmozhi.List"
|
2023-08-27 21:53:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/api/target_languages": {
|
|
|
|
"get": {
|
|
|
|
"summary": "Show list of available target languages for engine",
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Engine name",
|
|
|
|
"name": "engine",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
2023-09-11 09:15:41 +05:30
|
|
|
"description": "OK",
|
2023-08-27 21:53:49 +05:30
|
|
|
"schema": {
|
2023-09-11 09:15:41 +05:30
|
|
|
"$ref": "#/definitions/libmozhi.List"
|
2023-08-27 21:53:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/api/translate": {
|
|
|
|
"get": {
|
2023-09-09 20:03:14 +05:30
|
|
|
"description": "When engine is set to all, it will return an array of libmozhi.LangOut.",
|
2023-08-27 21:53:49 +05:30
|
|
|
"summary": "Translate text",
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Engine name",
|
|
|
|
"name": "engine",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Source language",
|
|
|
|
"name": "from",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Target language",
|
|
|
|
"name": "to",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Text being translated",
|
|
|
|
"name": "text",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"responses": {
|
|
|
|
"200": {
|
2023-09-11 09:15:41 +05:30
|
|
|
"description": "OK",
|
2023-08-27 21:53:49 +05:30
|
|
|
"schema": {
|
2023-09-11 09:15:41 +05:30
|
|
|
"$ref": "#/definitions/libmozhi.LangOut"
|
2023-08-27 21:53:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"/api/tts": {
|
|
|
|
"get": {
|
|
|
|
"summary": "Get Text-To-Speech for specified language using specified engine",
|
|
|
|
"parameters": [
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Engine name",
|
|
|
|
"name": "engine",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Language being TTS'd",
|
|
|
|
"name": "lang",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "string",
|
|
|
|
"description": "Text being TTS'd",
|
|
|
|
"name": "text",
|
|
|
|
"in": "query",
|
|
|
|
"required": true
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"responses": {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"definitions": {
|
2024-04-14 18:41:18 +05:30
|
|
|
"libmozhi.ImgOut": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"sourceB64": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"sourceLang": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"sourceTextParsed": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"targetLang": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"translatedImgB64": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"translatedTextParsed": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-09-11 09:15:41 +05:30
|
|
|
"libmozhi.LangOut": {
|
2023-08-27 21:53:49 +05:30
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"detected": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"engine": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"source_language": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
2024-04-14 18:41:18 +05:30
|
|
|
"source_transliteration": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
2023-08-27 21:53:49 +05:30
|
|
|
"target_language": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
2024-04-14 18:41:18 +05:30
|
|
|
"target_transliteration": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
2023-08-27 21:53:49 +05:30
|
|
|
"translated-text": {
|
|
|
|
"type": "string"
|
2023-11-12 11:48:52 +05:30
|
|
|
},
|
|
|
|
"word_choices": {
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"$ref": "#/definitions/libmozhi.WordChoices"
|
|
|
|
}
|
2023-08-27 21:53:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2023-09-11 09:15:41 +05:30
|
|
|
"libmozhi.List": {
|
2023-08-27 21:53:49 +05:30
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"id": {
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"name": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
2023-11-12 11:48:52 +05:30
|
|
|
},
|
|
|
|
"libmozhi.WordChoices": {
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"examples_source": {
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"examples_target": {
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"word": {
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
}
|
2023-08-27 21:53:49 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|