[pre-commit.ci] pre-commit autoupdate (#176)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 23.12.1 → 24.1.1](https://github.com/psf/black/compare/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>
Этот коммит содержится в:
pre-commit-ci[bot] 2024-01-31 14:17:29 +01:00 коммит произвёл GitHub
родитель f128fa4754
Коммит b4aae9321c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 27 добавлений и 19 удалений

Просмотреть файл

@ -5,7 +5,7 @@ repos:
- id: nbstripout - id: nbstripout
files: ".ipynb" files: ".ipynb"
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.12.1 rev: 24.1.1
hooks: hooks:
- id: black - id: black
- repo: https://github.com/pycqa/flake8 - repo: https://github.com/pycqa/flake8

Просмотреть файл

@ -479,12 +479,16 @@ class AnalysisExplorer:
detector_class = identify_function( detector_class = identify_function(
image_copy, image_copy,
analyse_text=analyse_text, analyse_text=analyse_text,
model_names=[settings_text_model_names] model_names=(
if (settings_text_model_names is not None) [settings_text_model_names]
else None, if (settings_text_model_names is not None)
revision_numbers=[settings_text_revision_numbers] else None
if (settings_text_revision_numbers 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": elif detector_value == "EmotionDetector":
detector_class = identify_function( detector_class = identify_function(
@ -502,9 +506,11 @@ class AnalysisExplorer:
image_copy, image_copy,
analysis_type=setting_summary_analysis_type, analysis_type=setting_summary_analysis_type,
model_type=setting_summary_model, model_type=setting_summary_model,
list_of_questions=[setting_summary_list_of_questions] list_of_questions=(
if (setting_summary_list_of_questions is not None) [setting_summary_list_of_questions]
else None, if (setting_summary_list_of_questions is not None)
else None
),
) )
else: else:
detector_class = identify_function(image_copy) detector_class = identify_function(image_copy)

Просмотреть файл

@ -534,9 +534,9 @@ class MultimodalSearch(AnalysisMethod):
self.subdict[image_keys[key]][ self.subdict[image_keys[key]][
"rank " + list(search_query[q].values())[0] "rank " + list(search_query[q].values())[0]
] = places[q][key] ] = places[q][key]
self.subdict[image_keys[key]][ self.subdict[image_keys[key]][list(search_query[q].values())[0]] = (
list(search_query[q].values())[0] similarity[key][q].item()
] = similarity[key][q].item() )
else: else:
self.subdict[image_keys[key]][ self.subdict[image_keys[key]][
"rank " + list(search_query[q].values())[0] "rank " + list(search_query[q].values())[0]
@ -915,9 +915,9 @@ class MultimodalSearch(AnalysisMethod):
avg_gradcams.append(local_avg_gradcams) avg_gradcams.append(local_avg_gradcams)
itm_scores.append(local_itm_scores) itm_scores.append(local_itm_scores)
itm_scores2.append(local_itm_scores2) itm_scores2.append(local_itm_scores2)
image_gradcam_with_itm[ image_gradcam_with_itm[list(search_query[index_text_query].values())[0]] = (
list(search_query[index_text_query].values())[0] localimage_gradcam_with_itm
] = localimage_gradcam_with_itm )
del ( del (
itm_model, itm_model,
vis_processor_itm, vis_processor_itm,

Просмотреть файл

@ -220,9 +220,11 @@ class TextDetector(AnalysisMethod):
"""Clean the text from unrecognized words and any numbers.""" """Clean the text from unrecognized words and any numbers."""
templist = [] templist = []
for token in self.doc: for token in self.doc:
templist.append( (
token.text templist.append(token.text)
) if token.pos_ != "NUM" and token.has_vector else None if token.pos_ != "NUM" and token.has_vector
else None
)
self.subdict["text_clean"] = " ".join(templist).rstrip().lstrip() self.subdict["text_clean"] = " ".join(templist).rstrip().lstrip()
def text_summary(self): def text_summary(self):