Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#176)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 23.12.1 → 24.1.1](psf/black@23.12.1...24.1.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jan 31, 2024
1 parent f128fa4 commit b4aae93
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: nbstripout
files: ".ipynb"
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
Expand Down
24 changes: 15 additions & 9 deletions ammico/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,16 @@ def _right_output_analysis(
detector_class = identify_function(
image_copy,
analyse_text=analyse_text,
model_names=[settings_text_model_names]
if (settings_text_model_names is not None)
else None,
revision_numbers=[settings_text_revision_numbers]
if (settings_text_revision_numbers is not None)
else None,
model_names=(
[settings_text_model_names]
if (settings_text_model_names is not None)
else None
),
revision_numbers=(
[settings_text_revision_numbers]
if (settings_text_revision_numbers is not None)
else None
),
)
elif detector_value == "EmotionDetector":
detector_class = identify_function(
Expand All @@ -502,9 +506,11 @@ def _right_output_analysis(
image_copy,
analysis_type=setting_summary_analysis_type,
model_type=setting_summary_model,
list_of_questions=[setting_summary_list_of_questions]
if (setting_summary_list_of_questions is not None)
else None,
list_of_questions=(
[setting_summary_list_of_questions]
if (setting_summary_list_of_questions is not None)
else None
),
)
else:
detector_class = identify_function(image_copy)
Expand Down
12 changes: 6 additions & 6 deletions ammico/multimodal_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,9 @@ def multimodal_search(
self.subdict[image_keys[key]][
"rank " + list(search_query[q].values())[0]
] = places[q][key]
self.subdict[image_keys[key]][
list(search_query[q].values())[0]
] = similarity[key][q].item()
self.subdict[image_keys[key]][list(search_query[q].values())[0]] = (
similarity[key][q].item()
)
else:
self.subdict[image_keys[key]][
"rank " + list(search_query[q].values())[0]
Expand Down Expand Up @@ -915,9 +915,9 @@ def image_text_match_reordering(
avg_gradcams.append(local_avg_gradcams)
itm_scores.append(local_itm_scores)
itm_scores2.append(local_itm_scores2)
image_gradcam_with_itm[
list(search_query[index_text_query].values())[0]
] = localimage_gradcam_with_itm
image_gradcam_with_itm[list(search_query[index_text_query].values())[0]] = (
localimage_gradcam_with_itm
)
del (
itm_model,
vis_processor_itm,
Expand Down
8 changes: 5 additions & 3 deletions ammico/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,11 @@ def clean_text(self):
"""Clean the text from unrecognized words and any numbers."""
templist = []
for token in self.doc:
templist.append(
token.text
) if token.pos_ != "NUM" and token.has_vector else None
(
templist.append(token.text)
if token.pos_ != "NUM" and token.has_vector
else None
)
self.subdict["text_clean"] = " ".join(templist).rstrip().lstrip()

def text_summary(self):
Expand Down

0 comments on commit b4aae93

Please sign in to comment.