mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
depracated
This commit is contained in:
parent
490d1a5a89
commit
43497402d6
@ -1,39 +0,0 @@
|
||||
import requests, os
|
||||
from translator.basetranslator import basetrans
|
||||
from myutils.subproc import subproc_w, autoproc
|
||||
|
||||
|
||||
class TS(basetrans):
|
||||
def inittranslator(self):
|
||||
checks = ["Runtime", "tokenizator", "translator"]
|
||||
self.checkempty(checks)
|
||||
|
||||
self.Port = self.config["Port"]
|
||||
server = os.path.join(self.config["Runtime"], "server.py")
|
||||
pyexe = os.path.join(
|
||||
self.config["Runtime"], "python-3.11.8-embed-amd64/python.exe"
|
||||
)
|
||||
for k in [self.config[k] for k in checks] + [server, pyexe]:
|
||||
if os.path.exists(k) == False:
|
||||
raise Exception("not exists:" + k)
|
||||
|
||||
self.engine = autoproc(
|
||||
subproc_w(
|
||||
'"{}" "{}" "{}" "{}" {}'.format(
|
||||
pyexe,
|
||||
server,
|
||||
self.config["translator"],
|
||||
self.config["tokenizator"],
|
||||
self.Port,
|
||||
),
|
||||
name="sugoi",
|
||||
)
|
||||
)
|
||||
|
||||
def translate(self, query):
|
||||
return (
|
||||
requests.get(
|
||||
"http://127.0.0.1:{}/translate".format(self.Port),
|
||||
params={"text": query},
|
||||
).json()
|
||||
)["trans"]
|
@ -1,22 +0,0 @@
|
||||
from translator.basetranslator import basetrans
|
||||
|
||||
|
||||
class TS(basetrans):
|
||||
def langmap(self):
|
||||
return {"en": "English", "ja": "Japanese", "zh": "Chinese", "vi": "Vietnamese"}
|
||||
|
||||
def translate(self, query):
|
||||
|
||||
json_data = {
|
||||
"content": {
|
||||
"input_text": query,
|
||||
"input_language": self.srclang,
|
||||
"output_language": self.tgtlang,
|
||||
},
|
||||
"message": "translate sentences",
|
||||
}
|
||||
|
||||
response = self.session.post(
|
||||
"https://translation-server-proxy-7ja5f.ondigitalocean.app/", json=json_data
|
||||
)
|
||||
return response.json()[0]
|
@ -955,18 +955,6 @@
|
||||
"color": "#1839f0",
|
||||
"name": "Jbeijing7"
|
||||
},
|
||||
"sugoi": {
|
||||
"type": "offline",
|
||||
"use": false,
|
||||
"color": "#1839f0",
|
||||
"name": "Sugoi"
|
||||
},
|
||||
"sugoionline": {
|
||||
"use": true,
|
||||
"color": "#1839f0",
|
||||
"name": "Sugoi",
|
||||
"useproxy": true
|
||||
},
|
||||
"kingsoft": {
|
||||
"type": "offline",
|
||||
"use": false,
|
||||
|
@ -99,48 +99,6 @@
|
||||
"key": ""
|
||||
}
|
||||
},
|
||||
"sugoi": {
|
||||
"args": {
|
||||
"Runtime": "",
|
||||
"Port":8000,
|
||||
"tokenizator":"",
|
||||
"translator":"",
|
||||
"Download_Runtime":"https://github.com/HIllya51/RESOURCES/releases/download/offline_translator/SugoiRuntime.zip",
|
||||
"Download_Sugoi":"https://github.com/zyddnys/manga-image-translator/releases/download/beta-0.3/sugoi-models.zip"
|
||||
}
|
||||
,
|
||||
"argstype":{
|
||||
"Download_Runtime":{
|
||||
"type":"label",
|
||||
"islink":true
|
||||
},
|
||||
"Download_Sugoi":{
|
||||
"type":"label",
|
||||
"islink":true
|
||||
},
|
||||
"Runtime":{
|
||||
"type":"file",
|
||||
"dir":true,
|
||||
"filter":"SugoiRuntime"
|
||||
},
|
||||
"Port":{
|
||||
"type":"intspin",
|
||||
"min":1,
|
||||
"max":65535,
|
||||
"step":1
|
||||
},
|
||||
"translator":{
|
||||
"type":"file",
|
||||
"dir":false,
|
||||
"filter":"model.bin"
|
||||
},
|
||||
"tokenizator":{
|
||||
"type":"file",
|
||||
"dir":false,
|
||||
"filter":"spm.*.nopretok.model"
|
||||
}
|
||||
}
|
||||
},
|
||||
"huoshanapi": {
|
||||
"args": {
|
||||
"注册网址": "https://www.volcengine.com/docs/4640/130872",
|
||||
|
Loading…
x
Reference in New Issue
Block a user