|
import requests |
|
import os |
|
|
|
langs_data={ |
|
"APP": { |
|
"default": "APP", |
|
"en": "APP", |
|
"de": "APP", |
|
"fr": "APP", |
|
"az": "APP" |
|
}, |
|
"文本": { |
|
"default": "文本", |
|
"en": "Text", |
|
"de": "Text", |
|
"fr": "Texte", |
|
"az": "Mətn" |
|
}, |
|
"在这里输入文本": { |
|
"default": "在这里输入文本", |
|
"en": "Enter text here", |
|
"de": "Hier Text eingeben", |
|
"fr": "Entrez du texte ici", |
|
"az": "Mətni buraya daxil edin" |
|
}, |
|
"选择性别": { |
|
"default": "选择性别", |
|
"en": "Select gender", |
|
"de": "Geschlecht wählen", |
|
"fr": "Sélectionner le sexe", |
|
"az": "Cinsiyyəti seçin" |
|
}, |
|
"选择发音人": { |
|
"default": "选择发音人", |
|
"en": "Select voice", |
|
"de": "Sprecher wählen", |
|
"fr": "Sélectionner la voix", |
|
"az": "Səsi seçin" |
|
}, |
|
"合成的语音": { |
|
"default": "合成的语音", |
|
"en": "Synthesized speech", |
|
"de": "Synthetische Sprache", |
|
"fr": "Parole synthétisée", |
|
"az": "Sintez dil" |
|
}, |
|
"选择语言": { |
|
"default": "选择语言", |
|
"en": "Select Language", |
|
"de": "Sprache auswählen", |
|
"fr": "Sélectionner la langue", |
|
"az": "Dil seçin" |
|
}, |
|
"遇到未知错误,联系作者处理": { |
|
"default": "遇到未知错误,联系作者处理", |
|
"en": "Encountered an unknown error, contact the author for assistance", |
|
"de": "Es ist ein unbekannter Fehler aufgetreten, wenden Sie sich an den Autor", |
|
"fr": "Erreur inconnue rencontrée, contactez l'auteur pour obtenir de l'aide", |
|
"az": "Bilinmeyen bir hata oluştu, yardım için yazar ile iletişime geçin" |
|
}, |
|
"Gradio 版 OpenAI/Edge 文字转语音": { |
|
"default": "Gradio 版 OpenAI/Edge 文字转语音", |
|
"en": "Gradio version OpenAI/Edge Text-to-Speech", |
|
"de": "Gradio Version OpenAI/Edge Text-to-Speech", |
|
"fr": "Gradio version OpenAI/Edge Text-to-Speech", |
|
"az": "Gradio versionu OpenAI/Edge Metin-səsə çevirmə" |
|
}, |
|
"tailer_markdown": { |
|
"default": "\n<div align=\"center\">\n\n**[作者](https://github.com/linexjlin)的其他项目**\n\n| | |\n| ------------------------------- | --------------------------------------- |\n| 👨🏻💻 **InputGPT 任意输入区调用GPT** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n| 👨🏻💻 **OpenAI_TTS 需要自己的key** | [OpenAI_TTS](https://modelscope.cn/studios/VBNn0x/OpenAI_TTS_TEST/summary) |\n| 👨🏻💻 **伴奏人声提取** | [UVR](https://modelscope.cn/studios/VBNn0x/UVR/summary) |\n\nAIGC 交流 💬\n\n<img src=\"https://cn-hz-ali.oss-cn-hangzhou.aliyuncs.com/js/aigc-share.svg\"><img>\n\n<p>\n 遇到问题联系\n <img width=15 src=\"https://cn-hz-ali.oss-cn-hangzhou.aliyuncs.com/js/wechat.svg\" style=\"display: inline-block; vertical-align: middle;\"> \n cmVkX2xhbmQ= (base64)\n</p>\n\n\n\n</div>\n", |
|
"en": "<div align=\"center\">\n\n**[My](https://github.com/linexjlin) other projects.**\n\n|||\n| - | -|\n| 👨🏻💻 **InputGPT Call GPT in any input area** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n\nContact me: [𝕏](https://twitter.com/linexjlin) [github](https://github.com/linexjlin)\n\n\n\n</div>\n", |
|
"de": "<div align=\"center\">\n\n**[My](https://github.com/linexjlin) other projects.**\n\n|||\n| - | -|\n| 👨🏻💻 **InputGPT Call GPT in any input area** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n\nContact me: [𝕏](https://twitter.com/linexjlin) [github](https://github.com/linexjlin)\n\n\n\n</div>\n", |
|
"fr": "<div align=\"center\">\n\n**[My](https://github.com/linexjlin) other projects.**\n\n|||\n| - | -|\n| 👨🏻💻 **InputGPT Call GPT in any input area** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n\nContact me: [𝕏](https://twitter.com/linexjlin) [github](https://github.com/linexjlin)\n\n\n\n</div>\n", |
|
"az": "<div align=\"center\">\n\n**[My](https://github.com/linexjlin) other projects.**\n\n|||\n| - | -|\n| 👨🏻💻 **InputGPT Call GPT in any input area** | [InputGPT](https://github.com/linexjlin/inputGPT) |\n\nContact me: [𝕏](https://twitter.com/linexjlin) [github](https://github.com/linexjlin)\n\n\n\n</div>\n" |
|
} |
|
} |
|
|
|
|
|
def UText(k): |
|
l = os.getenv("ULANG") if os.getenv("ULANG") else "default" |
|
if k in langs_data: |
|
if l in langs_data[k]: |
|
return langs_data[k][l] if langs_data[k][l] else k |
|
else: |
|
print(f"not supported lang: {l}") |
|
request_online(k,l) |
|
return k |
|
else: |
|
request_online(k,l) |
|
return k |
|
|
|
def request_online(k,l): |
|
url = f"https://i18n.linkown.com/ce405723-a840-468d-a57f-0bb95cbfbcfb/key" |
|
|
|
params = {'k': k,'l':l} |
|
response = requests.get(url, params=params) |
|
|
|
if response.status_code == 200: |
|
result = response.json()["result"] |
|
return result |
|
else: |
|
print(f"Failed to get data. Status code: {response.status_code}") |