ch-tseng commited on
Commit
6bbd9db
·
1 Parent(s): 400f5c2
Files changed (1) hide show
  1. app.py +23 -13
app.py CHANGED
@@ -7,8 +7,12 @@
7
  @Description:
8
  -------------------------------------------------
9
  """
10
- #from dotenv import load_dotenv
11
- #load_dotenv()
 
 
 
 
12
 
13
  from pathlib import Path
14
  from PIL import Image
@@ -32,21 +36,27 @@ base_download_path = "downloaded"
32
  if not os.path.exists(base_download_path):
33
  os.makedirs(base_download_path)
34
 
35
- #model_count = int(os.getenv("model_count"))
36
- model_count = int(st.secrets["model_count"])
 
 
 
37
 
38
  model_info = {}
39
  models_list = []
40
  for i in range(0, model_count):
41
- #model_name = os.getenv("m{}_name".format(i))
42
- #gdrive_id = os.getenv("m{}_griv".format(i))
43
- #model_extname = os.getenv("m{}_type".format(i))
44
- #model_desc = os.getenv("m{}_desc".format(i))
45
-
46
- model_name = st.secrets["m{}_name".format(i)]
47
- gdrive_id = st.secrets["m{}_griv".format(i)]
48
- model_extname = st.secrets["m{}_type".format(i)]
49
- model_desc = st.secrets["m{}_desc".format(i)]
 
 
 
50
  print(i, model_name, gdrive_id, model_extname, model_desc)
51
 
52
  path_model = os.path.join(base_download_path, model_name + model_extname)
 
7
  @Description:
8
  -------------------------------------------------
9
  """
10
+
11
+ HuggingFace = True
12
+
13
+ if HuggingFace is False:
14
+ from dotenv import load_dotenv
15
+ load_dotenv()
16
 
17
  from pathlib import Path
18
  from PIL import Image
 
36
  if not os.path.exists(base_download_path):
37
  os.makedirs(base_download_path)
38
 
39
+ if HuggingFace is False:
40
+ model_count = int(os.getenv("model_count"))
41
+
42
+ else:
43
+ model_count = int(st.secrets["model_count"])
44
 
45
  model_info = {}
46
  models_list = []
47
  for i in range(0, model_count):
48
+ if HuggingFace is False:
49
+ model_name = os.getenv("m{}_name".format(i))
50
+ gdrive_id = os.getenv("m{}_griv".format(i))
51
+ model_extname = os.getenv("m{}_type".format(i))
52
+ model_desc = os.getenv("m{}_desc".format(i))
53
+
54
+ else:
55
+ model_name = st.secrets["m{}_name".format(i)]
56
+ gdrive_id = st.secrets["m{}_griv".format(i)]
57
+ model_extname = st.secrets["m{}_type".format(i)]
58
+ model_desc = st.secrets["m{}_desc".format(i)]
59
+
60
  print(i, model_name, gdrive_id, model_extname, model_desc)
61
 
62
  path_model = os.path.join(base_download_path, model_name + model_extname)