Skip to content

Commit dd15934

Browse files
authored
Update model_handler.py
1 parent e7a2f86 commit dd15934

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

ads/aqua/extension/model_handler.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,24 @@ def get(
3737
raise HTTPError(
3838
400, Errors.MISSING_REQUIRED_PARAMETER.format("model_format")
3939
)
40-
try:
41-
model_format = model_format.upper()
42-
except ValueError as err:
43-
raise AquaValueError(f"Invalid model format: {model_format}") from err
40+
41+
model_format = model_format.upper()
42+
43+
if os_path:
44+
return self.finish(
45+
AquaModelApp.get_model_files(os_path, model_format)
46+
)
47+
elif model_name:
48+
return self.finish(
49+
AquaModelApp.get_hf_model_files(model_name, model_format)
50+
)
4451
else:
45-
if os_path:
46-
return self.finish(
47-
AquaModelApp.get_model_files(os_path, model_format)
48-
)
49-
elif model_name:
50-
return self.finish(
51-
AquaModelApp.get_hf_model_files(model_name, model_format)
52-
)
53-
else:
54-
raise HTTPError(
55-
400,
56-
Errors.MISSING_ONEOF_REQUIRED_PARAMETER.format(
57-
"os_path", "model_name"
58-
),
59-
)
52+
raise HTTPError(
53+
400,
54+
Errors.MISSING_ONEOF_REQUIRED_PARAMETER.format(
55+
"os_path", "model_name"
56+
),
57+
)
6058
elif not model_id:
6159
return self.list()
6260

0 commit comments

Comments
 (0)