Skip to content

Commit 84fceae

Browse files
authored
[AI Tagger] 2.0 small fixes (#480)
1 parent 4a47e4d commit 84fceae

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

plugins/AITagger/ai_tagger.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ def install(package):
4040
except ModuleNotFoundError:
4141
install('pydantic')
4242
toRaise = True
43+
44+
try:
45+
import cv2
46+
except ModuleNotFoundError:
47+
install('opencv-python')
48+
toRaise = True
4349

4450
if toRaise:
4551
raise Exception("Installed required packages, please retry the task.")
@@ -53,11 +59,6 @@ def install(package):
5359
import ai_server
5460
import utility
5561
from datetime import datetime
56-
try:
57-
import cv2
58-
except ModuleNotFoundError:
59-
install('opencv-python')
60-
toRaise = True
6162
except:
6263
log.error("Attempted to install required packages, please retry the task.")
6364
log.error(f"Stack trace {traceback.format_exc()}")
@@ -238,7 +239,7 @@ async def __tag_images(images):
238239
else:
239240
tags_list = []
240241
for _, tags in result.items():
241-
stashtag_ids = media_handler.get_tag_ids(tags)
242+
stashtag_ids = media_handler.get_tag_ids(tags, create=True)
242243
stashtag_ids.append(media_handler.ai_tagged_tag_id)
243244
tags_list.extend(stashtag_ids)
244245
media_handler.add_tags_to_image(id, tags_list)
@@ -375,4 +376,4 @@ def increment_progress():
375376
global increment
376377
progress += increment
377378
log.progress(progress)
378-
asyncio.run(main())
379+
asyncio.run(main())

plugins/AITagger/ai_tagger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: AI Tagger
22
description: Tag videos and Images with Locally hosted AI using Skier's Free and Patreon AI models
3-
version: 2.0
3+
version: 2.1
44
url: https://github.com/stashapp/CommunityScripts/tree/main/plugins/AITagger
55
exec:
66
- python

0 commit comments

Comments
 (0)