GameSentenceMiner 2.13.6__tar.gz → 2.13.7.post1__tar.gz

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.
Files changed (79) hide show
  1. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/gsm.py +17 -18
  2. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/owocr/owocr/ocr.py +17 -11
  3. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/owocr/owocr/run.py +248 -177
  4. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/configuration.py +8 -7
  5. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner.egg-info/PKG-INFO +1 -1
  6. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/PKG-INFO +1 -1
  7. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/pyproject.toml +1 -1
  8. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/__init__.py +0 -0
  9. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/ai/__init__.py +0 -0
  10. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/ai/ai_prompting.py +0 -0
  11. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/anki.py +0 -0
  12. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/assets/__init__.py +0 -0
  13. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/assets/icon.png +0 -0
  14. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/assets/icon128.png +0 -0
  15. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/assets/icon256.png +0 -0
  16. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/assets/icon32.png +0 -0
  17. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/assets/icon512.png +0 -0
  18. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/assets/icon64.png +0 -0
  19. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/assets/pickaxe.png +0 -0
  20. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/config_gui.py +0 -0
  21. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/gametext.py +0 -0
  22. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/locales/en_us.json +0 -0
  23. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/locales/ja_jp.json +0 -0
  24. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/locales/zh_cn.json +0 -0
  25. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/obs.py +0 -0
  26. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/ocr/__init__.py +0 -0
  27. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/ocr/gsm_ocr_config.py +0 -0
  28. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/ocr/ocrconfig.py +0 -0
  29. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/ocr/owocr_area_selector.py +0 -0
  30. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/ocr/owocr_helper.py +0 -0
  31. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/ocr/ss_picker.py +0 -0
  32. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/owocr/owocr/__init__.py +0 -0
  33. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/owocr/owocr/__main__.py +0 -0
  34. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/owocr/owocr/config.py +0 -0
  35. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/owocr/owocr/lens_betterproto.py +0 -0
  36. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py +0 -0
  37. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/__init__.py +0 -0
  38. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/audio_offset_selector.py +0 -0
  39. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/communication/__init__.py +0 -0
  40. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/communication/send.py +0 -0
  41. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/communication/websocket.py +0 -0
  42. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/downloader/Untitled_json.py +0 -0
  43. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/downloader/__init__.py +0 -0
  44. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/downloader/download_tools.py +0 -0
  45. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/downloader/oneocr_dl.py +0 -0
  46. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/electron_config.py +0 -0
  47. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/ffmpeg.py +0 -0
  48. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/gsm_utils.py +0 -0
  49. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/model.py +0 -0
  50. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/notification.py +0 -0
  51. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/package.py +0 -0
  52. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/ss_selector.py +0 -0
  53. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/text_log.py +0 -0
  54. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/util/window_transparency.py +0 -0
  55. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/vad.py +0 -0
  56. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/__init__.py +0 -0
  57. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/service.py +0 -0
  58. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/__init__.py +0 -0
  59. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/apple-touch-icon.png +0 -0
  60. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/favicon-96x96.png +0 -0
  61. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/favicon.ico +0 -0
  62. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/favicon.svg +0 -0
  63. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/site.webmanifest +0 -0
  64. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/style.css +0 -0
  65. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/web-app-manifest-192x192.png +0 -0
  66. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/static/web-app-manifest-512x512.png +0 -0
  67. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/templates/__init__.py +0 -0
  68. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/templates/index.html +0 -0
  69. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/templates/text_replacements.html +0 -0
  70. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/templates/utility.html +0 -0
  71. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/web/texthooking_page.py +0 -0
  72. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner/wip/get_overlay_coords.py +0 -0
  73. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner.egg-info/SOURCES.txt +0 -0
  74. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner.egg-info/dependency_links.txt +0 -0
  75. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner.egg-info/entry_points.txt +0 -0
  76. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner.egg-info/requires.txt +0 -0
  77. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/GameSentenceMiner.egg-info/top_level.txt +0 -0
  78. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/LICENSE +0 -0
  79. {gamesentenceminer-2.13.6 → gamesentenceminer-2.13.7.post1}/setup.cfg +0 -0
@@ -9,6 +9,18 @@ import warnings
9
9
  os.environ.pop('TCL_LIBRARY', None)
10
10
 
11
11
 
12
+ def handle_error_in_initialization(e):
13
+ """Handle errors that occur during initialization."""
14
+ logger.exception(e, exc_info=True)
15
+ logger.info(
16
+ "An error occurred during initialization, Maybe try updating GSM from the menu or if running manually, try installing `pip install --update GameSentenceMiner`")
17
+ try:
18
+ while True:
19
+ time.sleep(1)
20
+ except KeyboardInterrupt:
21
+ logger.info("Exiting due to initialization error.")
22
+ sys.exit(1)
23
+
12
24
  try:
13
25
  import os.path
14
26
  import signal
@@ -45,11 +57,7 @@ try:
45
57
  from GameSentenceMiner.web.texthooking_page import run_text_hooker_page
46
58
  except Exception as e:
47
59
  from GameSentenceMiner.util.configuration import logger, is_linux, is_windows
48
- logger.info(
49
- "Something bad happened during import/initialization, closing in 5 seconds")
50
- logger.exception(e)
51
- time.sleep(5)
52
- sys.exit(1)
60
+ handle_error_in_initialization(e)
53
61
 
54
62
  if is_windows():
55
63
  import win32api
@@ -688,11 +696,7 @@ async def async_main(reloading=False):
688
696
  except Exception as e:
689
697
  logger.error(f"Error stopping observer: {e}")
690
698
  except Exception as e:
691
- logger.error(f"An error occurred during initialization: {e}", exc_info=True)
692
- notification.send_error_notification(
693
- "An error occurred during initialization. Check the log for details.")
694
- asyncio.sleep(5)
695
- raise e
699
+ handle_error_in_initialization(e)
696
700
 
697
701
 
698
702
  def main():
@@ -701,10 +705,8 @@ def main():
701
705
  try:
702
706
  asyncio.run(async_main())
703
707
  except Exception as e:
704
- logger.exception(e, exc_info=True)
705
- logger.info(
706
- "An error occurred during initialization, closing in 5 seconds")
707
- time.sleep(5)
708
+ handle_error_in_initialization(e)
709
+
708
710
 
709
711
 
710
712
  if __name__ == "__main__":
@@ -712,7 +714,4 @@ if __name__ == "__main__":
712
714
  try:
713
715
  asyncio.run(async_main())
714
716
  except Exception as e:
715
- logger.exception(e, exc_info=True)
716
- logger.info(
717
- "An error occurred during initialization, closing in 5 seconds")
718
- time.sleep(5)
717
+ handle_error_in_initialization(e)
@@ -1368,37 +1368,40 @@ class GroqOCR:
1368
1368
  return base64.b64encode(pil_image_to_bytes(img, png_compression=1)).decode('utf-8')
1369
1369
 
1370
1370
  # class QWENOCR:
1371
- # name = 'qwenvl'
1371
+ # name = 'qwenv2'
1372
1372
  # readable_name = 'Qwen2-VL'
1373
1373
  # key = 'q'
1374
1374
  # available = False
1375
- #
1375
+
1376
1376
  # def __init__(self, config={}, lang='ja'):
1377
1377
  # try:
1378
1378
  # import torch
1379
- # from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
1380
- # self.model = Qwen2VLForConditionalGeneration.from_pretrained(
1379
+ # import transformers
1380
+ # from transformers import AutoModelForImageTextToText, AutoProcessor
1381
+ # self.model = AutoModelForImageTextToText.from_pretrained(
1381
1382
  # "Qwen/Qwen2-VL-2B-Instruct", torch_dtype="auto", device_map="auto"
1382
1383
  # )
1383
1384
  # self.processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", use_fast=True)
1384
1385
  # self.device = "cuda" if torch.cuda.is_available() else "cpu"
1385
1386
  # print(self.device)
1386
1387
  # self.available = True
1387
- # logger.info('Qwen2-VL ready')
1388
+ # logger.info('Qwen2.5-VL ready')
1388
1389
  # except Exception as e:
1389
1390
  # logger.warning(f'Qwen2-VL not available: {e}')
1390
- #
1391
+
1391
1392
  # def __call__(self, img, furigana_filter_sensitivity=0):
1392
1393
  # if not self.available:
1393
1394
  # return (False, 'Qwen2-VL is not available.')
1394
1395
  # try:
1395
- # img = input_to_pil_image(img)
1396
+ # img, is_path = input_to_pil_image(img)
1397
+
1398
+ # # img.show()
1396
1399
  # conversation = [
1397
1400
  # {
1398
1401
  # "role": "user",
1399
1402
  # "content": [
1400
1403
  # {"type": "image"},
1401
- # {"type": "text", "text": "Analyze the image. Extract text *only* from within dialogue boxes (speech bubbles or panels containing character dialogue). If Text appears to be vertical, read the text from top to bottom, right to left. From the extracted dialogue text, filter out any furigana. Ignore and do not include any text found outside of dialogue boxes, including character names, speaker labels, or sound effects. Return *only* the filtered dialogue text. If no text is found within dialogue boxes after applying filters, return nothing. Do not include any other output, formatting markers, or commentary."},
1404
+ # {"type": "text", "text": "Analyze the image. Extract text *only* from within dialogue boxes (speech bubbles or panels containing character dialogue). If Text appears to be vertical, read the text from top to bottom, right to left. From the extracted dialogue text, filter out any furigana (Small characters above the kanji). Ignore and do not include any text found outside of dialogue boxes, including character names, speaker labels, or sound effects. Return *only* the filtered dialogue text. If no text is found within dialogue boxes after applying filters, return nothing. Do not include any other output, formatting markers, or commentary."},
1402
1405
  # ],
1403
1406
  # }
1404
1407
  # ]
@@ -1418,15 +1421,18 @@ class GroqOCR:
1418
1421
  # return (True, output_text[0] if output_text else "")
1419
1422
  # except Exception as e:
1420
1423
  # return (False, f'Qwen2-VL inference failed: {e}')
1424
+
1425
+ # def _preprocess(self, img):
1426
+ # return base64.b64encode(pil_image_to_bytes(img, png_compression=6)).decode('utf-8')
1421
1427
 
1422
1428
 
1423
1429
  # qwenocr = QWENOCR()
1424
- #
1430
+
1425
1431
  # for i in range(10):
1426
1432
  # start_time = time.time()
1427
- # res, text = qwenocr(Image.open('test_furigana.png'), furigana_filter_sensitivity=0) # Example usage
1433
+ # res, text = qwenocr(Image.open(r"C:\Users\Beangate\GSM\GameSentenceMiner\GameSentenceMiner\owocr\owocr\test_furigana.png"), furigana_filter_sensitivity=0) # Example usage
1428
1434
  # end_time = time.time()
1429
- #
1435
+
1430
1436
  # print(f"Time taken: {end_time - start_time:.2f} seconds")
1431
1437
  # print(text)
1432
1438
  # class LocalOCR: