update
Browse files
app.py
CHANGED
@@ -9,6 +9,8 @@
|
|
9 |
"""
|
10 |
|
11 |
HuggingFace = True
|
|
|
|
|
12 |
|
13 |
if HuggingFace is False:
|
14 |
from dotenv import load_dotenv
|
@@ -24,6 +26,26 @@ import os
|
|
24 |
|
25 |
query_params = st.experimental_get_query_params()
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
qmodel = 'crowded_human'
|
28 |
if 'model' in query_params:
|
29 |
qmodel = query_params['model'][0]
|
@@ -37,7 +59,6 @@ st.set_page_config(
|
|
37 |
)
|
38 |
|
39 |
|
40 |
-
base_download_path = "downloaded"
|
41 |
#------------------------
|
42 |
if not os.path.exists(base_download_path):
|
43 |
os.makedirs(base_download_path)
|
|
|
9 |
"""
|
10 |
|
11 |
HuggingFace = True
|
12 |
+
update_model_id = 0
|
13 |
+
base_download_path = "downloaded"
|
14 |
|
15 |
if HuggingFace is False:
|
16 |
from dotenv import load_dotenv
|
|
|
26 |
|
27 |
query_params = st.experimental_get_query_params()
|
28 |
|
29 |
+
#------------
|
30 |
+
if update_model_id is not None:
|
31 |
+
if HuggingFace is False:
|
32 |
+
model_name = os.getenv("m{}_name".format(update_model_id))
|
33 |
+
model_extname = os.getenv("m{}_type".format(update_model_id))
|
34 |
+
|
35 |
+
else:
|
36 |
+
model_name = st.secrets["m{}_name".format(update_model_id)]
|
37 |
+
model_extname = st.secrets["m{}_type".format(update_model_id)]
|
38 |
+
|
39 |
+
path_model = os.path.join(base_download_path, model_name + model_extname)
|
40 |
+
if os.path.exists(path_model):
|
41 |
+
try:
|
42 |
+
os.remove(path_model)
|
43 |
+
except:
|
44 |
+
print("Cannot remove", path_model)
|
45 |
+
continue
|
46 |
+
|
47 |
+
#-------------
|
48 |
+
|
49 |
qmodel = 'crowded_human'
|
50 |
if 'model' in query_params:
|
51 |
qmodel = query_params['model'][0]
|
|
|
59 |
)
|
60 |
|
61 |
|
|
|
62 |
#------------------------
|
63 |
if not os.path.exists(base_download_path):
|
64 |
os.makedirs(base_download_path)
|