admin commited on
Commit
1302388
·
1 Parent(s): de0886d
Files changed (2) hide show
  1. app.py +17 -14
  2. requirements.txt +2 -5
app.py CHANGED
@@ -1,12 +1,27 @@
1
  import os
2
  import torch
3
- import modelscope
4
- import huggingface_hub
5
  import gradio as gr
6
  from PIL import Image
7
  from torchvision.transforms import transforms
8
 
9
  EN_US = os.getenv("LANG") != "zh_CN.UTF-8"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  ZH2EN = {
11
  "上传细胞图像": "Upload a cell picture",
12
  "状态栏": "Status",
@@ -20,18 +35,6 @@ def _L(zh_txt: str):
20
  return ZH2EN[zh_txt] if EN_US else zh_txt
21
 
22
 
23
- MODEL_DIR = (
24
- huggingface_hub.snapshot_download(
25
- "Genius-Society/HEp2",
26
- cache_dir="./__pycache__",
27
- )
28
- if EN_US
29
- else modelscope.snapshot_download(
30
- "Genius-Society/HEp2",
31
- cache_dir="./__pycache__",
32
- )
33
- )
34
-
35
  TRANSLATE = {
36
  "Centromere": "着丝粒",
37
  "Golgi": "高尔基体",
 
1
  import os
2
  import torch
 
 
3
  import gradio as gr
4
  from PIL import Image
5
  from torchvision.transforms import transforms
6
 
7
  EN_US = os.getenv("LANG") != "zh_CN.UTF-8"
8
+
9
+ if EN_US:
10
+ import huggingface_hub
11
+
12
+ MODEL_DIR = huggingface_hub.snapshot_download(
13
+ "Genius-Society/HEp2",
14
+ cache_dir="./__pycache__",
15
+ )
16
+
17
+ else:
18
+ import modelscope
19
+
20
+ MODEL_DIR = modelscope.snapshot_download(
21
+ "Genius-Society/HEp2",
22
+ cache_dir="./__pycache__",
23
+ )
24
+
25
  ZH2EN = {
26
  "上传细胞图像": "Upload a cell picture",
27
  "状态栏": "Status",
 
35
  return ZH2EN[zh_txt] if EN_US else zh_txt
36
 
37
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  TRANSLATE = {
39
  "Centromere": "着丝粒",
40
  "Golgi": "高尔基体",
requirements.txt CHANGED
@@ -1,5 +1,2 @@
1
- torch==2.6.0+cu118
2
- -f https://download.pytorch.org/whl/torch
3
- torchvision==0.21.0+cu118
4
- -f https://download.pytorch.org/whl/torchvision
5
- modelscope[framework]==1.24.0
 
1
+ torch
2
+ torchvision