File size: 797 Bytes
7f341cf
 
 
ab0b684
7f341cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import modelscope
import huggingface_hub

EN_US = os.getenv("LANG") != "zh_CN.UTF-8"

MODEL_DIR = (
    huggingface_hub.snapshot_download(
        "Genius-Society/insecta",
        cache_dir="./__pycache__",
    )
    if EN_US
    else modelscope.snapshot_download(
        "Genius-Society/insecta",
        cache_dir="./__pycache__",
    )
)

ZH2EN = {
    "上传昆虫照片": "Upload insect picture",
    "状态栏": "Status",
    "识别结果": "Recognition result",
    "最可能的物种": "Best match",
    "图像文件格式支持 PNG, JPG, JPEG 和 BMP, 且文件大小不超过 10M": "Image file format support PNG, JPG, JPEG and BMP, and the file size does not exceed 10M.",
    "未知": "Unknown",
}


def _L(zh_txt: str):
    return ZH2EN[zh_txt] if EN_US else zh_txt