GameSentenceMiner 2.15.1__py3-none-any.whl → 2.15.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- GameSentenceMiner/obs.py +17 -6
- GameSentenceMiner/owocr/owocr/ocr.py +2 -24
- {gamesentenceminer-2.15.1.dist-info → gamesentenceminer-2.15.3.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.15.1.dist-info → gamesentenceminer-2.15.3.dist-info}/RECORD +8 -8
- {gamesentenceminer-2.15.1.dist-info → gamesentenceminer-2.15.3.dist-info}/WHEEL +0 -0
- {gamesentenceminer-2.15.1.dist-info → gamesentenceminer-2.15.3.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.15.1.dist-info → gamesentenceminer-2.15.3.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.15.1.dist-info → gamesentenceminer-2.15.3.dist-info}/top_level.txt +0 -0
GameSentenceMiner/obs.py
CHANGED
@@ -506,9 +506,16 @@ def set_fit_to_screen_for_scene_items(scene_name: str):
|
|
506
506
|
|
507
507
|
source_width = scene_item_transform.get('sourceWidth', None)
|
508
508
|
source_height = scene_item_transform.get('sourceHeight', None)
|
509
|
-
|
509
|
+
|
510
510
|
aspect_ratio_different = False
|
511
|
-
|
511
|
+
already_cropped = any([
|
512
|
+
scene_item_transform.get('cropLeft', 0) != 0,
|
513
|
+
scene_item_transform.get('cropRight', 0) != 0,
|
514
|
+
scene_item_transform.get('cropTop', 0) != 0,
|
515
|
+
scene_item_transform.get('cropBottom', 0) != 0,
|
516
|
+
])
|
517
|
+
|
518
|
+
if source_width and source_height and not already_cropped:
|
512
519
|
source_aspect_ratio = source_width / source_height
|
513
520
|
canvas_aspect_ratio = canvas_width / canvas_height
|
514
521
|
# Check if aspect ratio is different and if it's a standard aspect ratio
|
@@ -541,11 +548,15 @@ def set_fit_to_screen_for_scene_items(scene_name: str):
|
|
541
548
|
'boundsHeight': canvas_height,
|
542
549
|
'positionX': 0,
|
543
550
|
'positionY': 0,
|
544
|
-
'cropLeft': 0 if not aspect_ratio_different or canvas_width > source_width else (source_width - canvas_width) // 2,
|
545
|
-
'cropRight': 0 if not aspect_ratio_different or canvas_width > source_width else (source_width - canvas_width) // 2,
|
546
|
-
'cropTop': 0 if not aspect_ratio_different or canvas_height > source_height else (source_height - canvas_height) // 2,
|
547
|
-
'cropBottom': 0 if not aspect_ratio_different or canvas_height > source_height else (source_height - canvas_height) // 2,
|
548
551
|
}
|
552
|
+
|
553
|
+
if not already_cropped:
|
554
|
+
fit_to_screen_transform.update({
|
555
|
+
'cropLeft': 0 if not aspect_ratio_different or canvas_width > source_width else (source_width - canvas_width) // 2,
|
556
|
+
'cropRight': 0 if not aspect_ratio_different or canvas_width > source_width else (source_width - canvas_width) // 2,
|
557
|
+
'cropTop': 0 if not aspect_ratio_different or canvas_height > source_height else (source_height - canvas_height) // 2,
|
558
|
+
'cropBottom': 0 if not aspect_ratio_different or canvas_height > source_height else (source_height - canvas_height) // 2,
|
559
|
+
})
|
549
560
|
|
550
561
|
try:
|
551
562
|
client.set_scene_item_transform(
|
@@ -1014,7 +1014,6 @@ class OneOCR:
|
|
1014
1014
|
res = ocr_resp['text']
|
1015
1015
|
|
1016
1016
|
if multiple_crop_coords:
|
1017
|
-
logger.info(f"Getting multiple crop coords for {len(filtered_lines)} lines")
|
1018
1017
|
for line in filtered_lines:
|
1019
1018
|
crop_coords_list.append(
|
1020
1019
|
(line['bounding_rect']['x1'] - 5, line['bounding_rect']['y1'] - 5,
|
@@ -1434,13 +1433,10 @@ class localLLMOCR:
|
|
1434
1433
|
self.keep_warm = config.get('keep_warm', True)
|
1435
1434
|
self.custom_prompt = config.get('prompt', None)
|
1436
1435
|
self.available = True
|
1437
|
-
if any(x in self.api_url for x in ['localhost', '127.0.0.1']):
|
1438
|
-
if not self.check_connection(self.api_url):
|
1439
|
-
logger.warning('Local LLM OCR API is not reachable')
|
1440
|
-
return
|
1441
1436
|
self.client = openai.OpenAI(
|
1442
1437
|
base_url=self.api_url.replace('/v1/chat/completions', '/v1'),
|
1443
|
-
api_key=self.api_key
|
1438
|
+
api_key=self.api_key,
|
1439
|
+
timeout=3
|
1444
1440
|
)
|
1445
1441
|
if self.client.models.retrieve(self.model):
|
1446
1442
|
self.model = self.model
|
@@ -1450,24 +1446,6 @@ class localLLMOCR:
|
|
1450
1446
|
self.keep_llm_hot_thread.start()
|
1451
1447
|
except Exception as e:
|
1452
1448
|
logger.warning(f'Error initializing Local LLM OCR, Local LLM OCR will not work!')
|
1453
|
-
|
1454
|
-
def check_connection(self, url, port=None):
|
1455
|
-
import http.client
|
1456
|
-
conn = http.client.HTTPConnection(url, port or 1234, timeout=0.1)
|
1457
|
-
try:
|
1458
|
-
conn.request("GET", "/v1/models")
|
1459
|
-
response = conn.getresponse()
|
1460
|
-
if response.status == 200:
|
1461
|
-
logger.info('Local LLM OCR API is reachable')
|
1462
|
-
return True
|
1463
|
-
else:
|
1464
|
-
logger.warning('Local LLM OCR API is not reachable')
|
1465
|
-
return False
|
1466
|
-
except Exception as e:
|
1467
|
-
logger.warning(f'Error connecting to Local LLM OCR API: {e}')
|
1468
|
-
return False
|
1469
|
-
finally:
|
1470
|
-
conn.close()
|
1471
1449
|
|
1472
1450
|
def keep_llm_warm(self):
|
1473
1451
|
def ocr_blank_black_image():
|
@@ -3,7 +3,7 @@ GameSentenceMiner/anki.py,sha256=4Tq6OGjfN-5tYorYRWiih7FZjSKMG6amrLv6DFKkFQc,253
|
|
3
3
|
GameSentenceMiner/config_gui.py,sha256=G36MLR1UcdiLB6V3T25_ggGVnt5B4Vj1pS76nQQMqpk,139669
|
4
4
|
GameSentenceMiner/gametext.py,sha256=fgBgLchezpauWELE9Y5G3kVCLfAneD0X4lJFoI3FYbs,10351
|
5
5
|
GameSentenceMiner/gsm.py,sha256=4mJn5v4WKqKAJEtph5e0v4YPVDOpvFN1ylV2vQvf_Dg,31913
|
6
|
-
GameSentenceMiner/obs.py,sha256=
|
6
|
+
GameSentenceMiner/obs.py,sha256=99V4WvBhbBTEGI1o3dlGzhqnktKFUxPc1-5vOBcV0lk,26296
|
7
7
|
GameSentenceMiner/vad.py,sha256=YCn4ZIc6_Q3IGOr5QNMiheVT3Ma5nisn8-V8xD53Mw4,19236
|
8
8
|
GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
GameSentenceMiner/ai/ai_prompting.py,sha256=41xdBzE88Jlt12A0D-T_cMfLO5j6MSxfniOptpwNZm0,24068
|
@@ -28,7 +28,7 @@ GameSentenceMiner/owocr/owocr/__init__.py,sha256=87hfN5u_PbL_onLfMACbc0F5j4KyIK9
|
|
28
28
|
GameSentenceMiner/owocr/owocr/__main__.py,sha256=XQaqZY99EKoCpU-gWQjNbTs7Kg17HvBVE7JY8LqIE0o,157
|
29
29
|
GameSentenceMiner/owocr/owocr/config.py,sha256=qM7kISHdUhuygGXOxmgU6Ef2nwBShrZtdqu4InDCViE,8103
|
30
30
|
GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
|
31
|
-
GameSentenceMiner/owocr/owocr/ocr.py,sha256=
|
31
|
+
GameSentenceMiner/owocr/owocr/ocr.py,sha256=JXUboda00-1GYzYYDTiYcPaeWKKwvMdQ-q_CHVB7h10,70014
|
32
32
|
GameSentenceMiner/owocr/owocr/run.py,sha256=xbBpyFCVfITZDztsRLT8_sX6BGf1o5LxOPxE9zUWfQc,79975
|
33
33
|
GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=Na6XStbQBtpQUSdbN3QhEswtKuU1JjReFk_K8t5ezQE,3395
|
34
34
|
GameSentenceMiner/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -72,9 +72,9 @@ GameSentenceMiner/web/templates/index.html,sha256=LqXZx7-NE42pXSpHNZ3To680rD-vt9
|
|
72
72
|
GameSentenceMiner/web/templates/text_replacements.html,sha256=tV5c8mCaWSt_vKuUpbdbLAzXZ3ATZeDvQ9PnnAfqY0M,8598
|
73
73
|
GameSentenceMiner/web/templates/utility.html,sha256=3flZinKNqUJ7pvrZk6xu__v67z44rXnaK7UTZ303R-8,16946
|
74
74
|
GameSentenceMiner/wip/__init___.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
75
|
-
gamesentenceminer-2.15.
|
76
|
-
gamesentenceminer-2.15.
|
77
|
-
gamesentenceminer-2.15.
|
78
|
-
gamesentenceminer-2.15.
|
79
|
-
gamesentenceminer-2.15.
|
80
|
-
gamesentenceminer-2.15.
|
75
|
+
gamesentenceminer-2.15.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
76
|
+
gamesentenceminer-2.15.3.dist-info/METADATA,sha256=4zXzdtgHkL9Tv-ZNqDJr5mZ9ra6O8UpACup5X0zOy7M,7317
|
77
|
+
gamesentenceminer-2.15.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
78
|
+
gamesentenceminer-2.15.3.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
79
|
+
gamesentenceminer-2.15.3.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
80
|
+
gamesentenceminer-2.15.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|