@@ -56,7 +56,7 @@ def _get_processor_function(model_type: str) -> Callable:
5656
5757 if "yolonas" in model_type :
5858 return _process_yolonas
59-
59+
6060 if "yolov12" in model_type :
6161 return _process_yolov12
6262
@@ -123,11 +123,7 @@ def _process_yolo(model_type: str, model_path: str, filename: str) -> str:
123123
124124 if "yolov8" in model_type or "yolov10" in model_type or "yolov11" in model_type :
125125 # try except for backwards compatibility with older versions of ultralytics
126- if (
127- "-cls" in model_type
128- or model_type .startswith ("yolov10" )
129- or model_type .startswith ("yolov11" )
130- ):
126+ if "-cls" in model_type or model_type .startswith ("yolov10" ) or model_type .startswith ("yolov11" ):
131127 nc = model ["model" ].yaml ["nc" ]
132128 args = model ["train_args" ]
133129 else :
@@ -215,44 +211,27 @@ def _process_yolov12(model_type: str, model_path: str, filename: str) -> str:
215211
216212 # Find any .pt file in model path
217213 model_files = os .listdir (model_path )
218- pt_file = next ((f for f in model_files if f .endswith (' .pt' )), None )
219-
214+ pt_file = next ((f for f in model_files if f .endswith (" .pt" )), None )
215+
220216 if pt_file is None :
221217 raise RuntimeError ("No .pt model file found in the provided path" )
222218
223219 # Copy the .pt file to weights.pt if not already named weights.pt
224220 if pt_file != "weights.pt" :
225- shutil .copy (
226- os .path .join (model_path , pt_file ),
227- os .path .join (model_path , "weights.pt" )
228- )
221+ shutil .copy (os .path .join (model_path , pt_file ), os .path .join (model_path , "weights.pt" ))
229222
230- required_files = [
231- "weights.pt"
232- ]
223+ required_files = ["weights.pt" ]
233224
234- optional_files = [
235- "results.csv" ,
236- "results.png" ,
237- "model_artifacts.json"
238- ]
225+ optional_files = ["results.csv" , "results.png" , "model_artifacts.json" ]
239226
240227 zip_file_name = "roboflow_deploy.zip"
241228 with zipfile .ZipFile (os .path .join (model_path , zip_file_name ), "w" ) as zipMe :
242229 for file in required_files :
243- zipMe .write (
244- os .path .join (model_path , file ),
245- arcname = file ,
246- compress_type = zipfile .ZIP_DEFLATED
247- )
248-
230+ zipMe .write (os .path .join (model_path , file ), arcname = file , compress_type = zipfile .ZIP_DEFLATED )
231+
249232 for file in optional_files :
250233 if os .path .exists (os .path .join (model_path , file )):
251- zipMe .write (
252- os .path .join (model_path , file ),
253- arcname = file ,
254- compress_type = zipfile .ZIP_DEFLATED
255- )
234+ zipMe .write (os .path .join (model_path , file ), arcname = file , compress_type = zipfile .ZIP_DEFLATED )
256235
257236 return zip_file_name
258237
0 commit comments