Skip to content

Commit

Permalink
raised exceptions where they were not properly raised
Browse files Browse the repository at this point in the history
  • Loading branch information
MinuraPunchihewa committed Jul 17, 2024
1 parent 326e40f commit 57485e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hugging_py_face/nlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def translation(self, text: Union[Text, List], lang_input: Text = None, lang_out
"""
if model is None:
if lang_input is None or lang_output is None:
InsufficientParametersException("lang_input and lang_output are required if model is not provided.")
raise InsufficientParametersException("lang_input and lang_output are required if model is not provided.")
model = f"{self.config['TASK_MODEL_MAP']['translation']}{lang_input}-{lang_output}"
return self._query(text, options=options, model=model, task='translation')
else:
Expand All @@ -428,7 +428,7 @@ def translation_in_df(self, df: DataFrame, column: Text, lang_input: Text = None
"""
if model is None:
if lang_input is None or lang_output is None:
InsufficientParametersException("lang_input and lang_output are required if model is not provided.")
raise InsufficientParametersException("lang_input and lang_output are required if model is not provided.")
model = f"{self.config['TASK_MODEL_MAP']['translation']}{lang_input}-{lang_output}"
predictions = self._query_in_df(df, column, options=options, model=model, task='translation')
else:
Expand Down

0 comments on commit 57485e2

Please sign in to comment.