Spaces:
Running
Running
Update models/model.py
Browse files- models/model.py +9 -1
models/model.py
CHANGED
@@ -106,10 +106,18 @@ def post_model(name, model_url, version, creator):
|
|
106 |
|
107 |
if not model_files.get('pth'):
|
108 |
return "抱歉!无法找到.pth模型文件,请检查链接对应的模型文件并稍后重试。"
|
109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
md5_hash = calculate_md5(os.path.join(unzips_folder,model_files['pth']))
|
111 |
zipfile = compress(modelname, list(model_files.values()))
|
112 |
|
|
|
113 |
a = get_info(model_files.get('pth'))
|
114 |
file_to_upload = open(zipfile, "rb")
|
115 |
info = a.get("info", "None"),
|
|
|
106 |
|
107 |
if not model_files.get('pth'):
|
108 |
return "抱歉!无法找到.pth模型文件,请检查链接对应的模型文件并稍后重试。"
|
109 |
+
else:
|
110 |
+
print("已找到.pth模型文件")
|
111 |
+
|
112 |
+
if not model_files.get('index'):
|
113 |
+
return "抱歉!无法找到.index模型文件,请检查链接对应的模型文件并稍后重试。"
|
114 |
+
else:
|
115 |
+
print("已找到.index模型文件")
|
116 |
+
|
117 |
md5_hash = calculate_md5(os.path.join(unzips_folder,model_files['pth']))
|
118 |
zipfile = compress(modelname, list(model_files.values()))
|
119 |
|
120 |
+
print(f"已打包模型文件:{model_files.values()}")
|
121 |
a = get_info(model_files.get('pth'))
|
122 |
file_to_upload = open(zipfile, "rb")
|
123 |
info = a.get("info", "None"),
|