admin
commited on
Commit
·
4c67384
1
Parent(s):
932ebb5
sync ms
Browse files
app.py
CHANGED
|
@@ -28,6 +28,12 @@ ZH2EN = {
|
|
| 28 |
This tool can generate your customized content.json to replace the font/content.json in your forked <a href='https://github.com/Society-Genius/eLuvLetter' target='_blank'>eLuvLetter</a> repository, in which the BGM widget is used to upload the audio played when opening the envelope, it is recommended not to be too large, please make sure the audio is completely uploaded before clicking the Generate button.""",
|
| 29 |
}
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
def _L(zh_txt: str):
|
| 33 |
return ZH2EN[zh_txt] if EN_US else zh_txt
|
|
@@ -41,11 +47,7 @@ def oversize(file_path: str, size_kb=1024):
|
|
| 41 |
|
| 42 |
def toBase64(file_path: str):
|
| 43 |
if not file_path:
|
| 44 |
-
file_path =
|
| 45 |
-
"https://www.modelscope.cn/studio/Genius-Society/eluvletter/resolve/master/example.mp3"
|
| 46 |
-
if EN_US
|
| 47 |
-
else "./example.mp3"
|
| 48 |
-
)
|
| 49 |
|
| 50 |
if oversize(file_path):
|
| 51 |
return ""
|
|
@@ -98,7 +100,7 @@ def infer(
|
|
| 98 |
|
| 99 |
if not os.path.exists(out_json):
|
| 100 |
out_json = None
|
| 101 |
-
raise
|
| 102 |
|
| 103 |
except Exception as e:
|
| 104 |
status = f"{e}"
|
|
@@ -155,7 +157,7 @@ if __name__ == "__main__":
|
|
| 155 |
"美嘉",
|
| 156 |
" 如果那天...^600没有^200见到你<br> 我想我^600不会^200那么伤心<br> 那么难过<br> 不会^200泪流满面<br> 但是^600如果^200没有遇见你<br> 我就^200不会了解^600如此高兴<br> 如此^200温柔<br> 如此^200可爱<br> 如此^200温暖<br> 如此^200幸福^200的感觉<br> ^600现在^600还好吗?<br> 我...^600现在还和天空^200恋爱着",
|
| 157 |
"eLuvLetter",
|
| 158 |
-
|
| 159 |
]
|
| 160 |
],
|
| 161 |
title=_L("表白信封自定义配置工具"),
|
|
|
|
| 28 |
This tool can generate your customized content.json to replace the font/content.json in your forked <a href='https://github.com/Society-Genius/eLuvLetter' target='_blank'>eLuvLetter</a> repository, in which the BGM widget is used to upload the audio played when opening the envelope, it is recommended not to be too large, please make sure the audio is completely uploaded before clicking the Generate button.""",
|
| 29 |
}
|
| 30 |
|
| 31 |
+
EXAMPLE = (
|
| 32 |
+
"https://www.modelscope.cn/studio/Genius-Society/eluvletter/resolve/master/example.mp3"
|
| 33 |
+
if EN_US
|
| 34 |
+
else "./example.mp3"
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
|
| 38 |
def _L(zh_txt: str):
|
| 39 |
return ZH2EN[zh_txt] if EN_US else zh_txt
|
|
|
|
| 47 |
|
| 48 |
def toBase64(file_path: str):
|
| 49 |
if not file_path:
|
| 50 |
+
file_path = EXAMPLE
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
if oversize(file_path):
|
| 53 |
return ""
|
|
|
|
| 100 |
|
| 101 |
if not os.path.exists(out_json):
|
| 102 |
out_json = None
|
| 103 |
+
raise FileExistsError(f"Failed to create {out_json}!")
|
| 104 |
|
| 105 |
except Exception as e:
|
| 106 |
status = f"{e}"
|
|
|
|
| 157 |
"美嘉",
|
| 158 |
" 如果那天...^600没有^200见到你<br> 我想我^600不会^200那么伤心<br> 那么难过<br> 不会^200泪流满面<br> 但是^600如果^200没有遇见你<br> 我就^200不会了解^600如此高兴<br> 如此^200温柔<br> 如此^200可爱<br> 如此^200温暖<br> 如此^200幸福^200的感觉<br> ^600现在^600还好吗?<br> 我...^600现在还和天空^200恋爱着",
|
| 159 |
"eLuvLetter",
|
| 160 |
+
EXAMPLE,
|
| 161 |
]
|
| 162 |
],
|
| 163 |
title=_L("表白信封自定义配置工具"),
|