GameSentenceMiner 2.12.0.dev6__py3-none-any.whl → 2.12.1__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.
@@ -5,16 +5,6 @@ from abc import ABC, abstractmethod
5
5
  from dataclasses import dataclass
6
6
  from enum import Enum
7
7
  from typing import List, Optional
8
-
9
-
10
- try:
11
- import torch
12
- from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForSeq2SeqLM, pipeline
13
-
14
- TRANSFORMERS_AVAILABLE = True
15
- except ImportError:
16
- TRANSFORMERS_AVAILABLE = False
17
-
18
8
  from google import genai
19
9
  from google.genai import types
20
10
  from groq import Groq
@@ -136,6 +126,13 @@ class AIManager(ABC):
136
126
  class LocalAIManager(AIManager):
137
127
  def __init__(self, model, logger: Optional[logging.Logger] = None):
138
128
  super().__init__(LocalAIConfig(model=model), logger)
129
+ try:
130
+ import torch
131
+ from transformers import AutoTokenizer, AutoModelForCausalLM, AutoModelForSeq2SeqLM, pipeline
132
+
133
+ self.transformers_available = True
134
+ except (ImportError, OSError):
135
+ self.transformers_available = False
139
136
  self.model_name = self.ai_config.model
140
137
  if MANUAL_MODEL_OVERRIDE:
141
138
  self.model_name = MANUAL_MODEL_OVERRIDE
@@ -147,7 +144,7 @@ class LocalAIManager(AIManager):
147
144
  self.is_encoder_decoder = False
148
145
  self.is_nllb = "nllb" in self.model_name.lower()
149
146
 
150
- if not TRANSFORMERS_AVAILABLE:
147
+ if not self.transformers_available:
151
148
  self.logger.error("Local AI dependencies not found. Please run: pip install torch transformers sentencepiece")
152
149
  return
153
150
 
GameSentenceMiner/anki.py CHANGED
@@ -191,7 +191,7 @@ def get_initial_card_info(last_note: AnkiCard, selected_lines):
191
191
  if get_config().anki.sentence_field not in note['fields']:
192
192
  logger.info("No HTML tags found to preserve, just fixing spacing")
193
193
  note['fields'][get_config().anki.sentence_field] = game_line.text
194
- elif selected_lines:
194
+ if selected_lines:
195
195
  try:
196
196
  sentence_in_anki = last_note.get_field(get_config().anki.sentence_field)
197
197
  logger.info(f"Attempting Preserve HTML for multi-line")
GameSentenceMiner/gsm.py CHANGED
@@ -609,9 +609,6 @@ async def async_main(reloading=False):
609
609
  signal.signal(signal.SIGINT, handle_exit()) # Handle Ctrl+C
610
610
  if is_windows():
611
611
  win32api.SetConsoleCtrlHandler(handle_exit())
612
-
613
- if is_beangate:
614
- settings_window.set_test_func(lambda: run_new_thread(run_test_code))
615
612
 
616
613
  gsm_status.ready = True
617
614
  gsm_status.status = "Ready"
@@ -2,8 +2,10 @@ import asyncio
2
2
  import io
3
3
  import base64
4
4
  from PIL import Image
5
+ from GameSentenceMiner.util.configuration import get_config
5
6
 
6
- from GameSentenceMiner.owocr.owocr.ocr import GoogleLens, OneOCR
7
+ if get_config().wip.overlay_websocket_send:
8
+ from GameSentenceMiner.owocr.owocr.ocr import GoogleLens, OneOCR
7
9
  from GameSentenceMiner.obs import *
8
10
 
9
11
  # OBS WebSocket settings
@@ -14,8 +16,9 @@ OBS_PASSWORD = 'your_obs_websocket_password' # Set your OBS WebSocket password h
14
16
  WINDOW_NAME = "Nier:Automata"
15
17
  WIDTH = 2560
16
18
  HEIGHT = 1440
17
- oneocr = OneOCR()
18
- lens = GoogleLens()
19
+ if get_config().wip.overlay_websocket_send:
20
+ oneocr = OneOCR()
21
+ lens = GoogleLens()
19
22
 
20
23
  def correct_ocr_text(detected_text: str, reference_text: str) -> str:
21
24
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.12.0.dev6
3
+ Version: 2.12.1
4
4
  Summary: A tool for mining sentences from games. Update: Overlay?
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -1,12 +1,12 @@
1
1
  GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- GameSentenceMiner/anki.py,sha256=VC87YMX_XiigB-Pqsz5y1zMh7DLmPAyhXeryAhmI1nI,19101
2
+ GameSentenceMiner/anki.py,sha256=FUwcWO0-arzfQjejQmDKP7pNNakhboo8InQ4s_jv6AY,19099
3
3
  GameSentenceMiner/config_gui.py,sha256=bK7mHLxDIXhghOJqL0VphgUOsEAPyI3mjl0uWtR4mPk,103249
4
4
  GameSentenceMiner/gametext.py,sha256=fNkz1dvvJCLQ1AD6NuAJhSiGUjG-OSNGzwQOGv8anGo,7776
5
- GameSentenceMiner/gsm.py,sha256=MO2ekb3C8vWDflrslcgWRMQIpoqIpzn2pqg_3NDkCgQ,25447
5
+ GameSentenceMiner/gsm.py,sha256=GGF0owRrrYJgdfXx-INwfuKbaoY-G5gLllE-sNrwYnI,25341
6
6
  GameSentenceMiner/obs.py,sha256=-5j4k1_sYYR1Lnbn9C-_yN9prqgGLICgx5l3uguv4xk,15917
7
7
  GameSentenceMiner/vad.py,sha256=zo9JpuEOCXczPXM-dq8lbr-zM-MPpfJ8aajggR3mKk4,18710
8
8
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- GameSentenceMiner/ai/ai_prompting.py,sha256=vRYSmEKD_OB3znEwRy8S1Amw_BTaylYBmVqVK9hxT54,26018
9
+ GameSentenceMiner/ai/ai_prompting.py,sha256=iHkEx2pQJ-tEyejOgYy4G0DcZc8qvBugVL6-CQpPSME,26089
10
10
  GameSentenceMiner/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  GameSentenceMiner/assets/icon.png,sha256=9GRL8uXUAgkUSlvbm9Pv9o2poFVRGdW6s2ub_DeUD9M,937624
12
12
  GameSentenceMiner/assets/icon128.png,sha256=l90j7biwdz5ahwOd5wZ-406ryEV9Pan93dquJQ3e1CI,18395
@@ -63,10 +63,10 @@ GameSentenceMiner/web/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
63
63
  GameSentenceMiner/web/templates/index.html,sha256=Gv3CJvNnhAzIVV_QxhNq4OD-pXDt1vKCu9k6WdHSXuA,215343
64
64
  GameSentenceMiner/web/templates/text_replacements.html,sha256=tV5c8mCaWSt_vKuUpbdbLAzXZ3ATZeDvQ9PnnAfqY0M,8598
65
65
  GameSentenceMiner/web/templates/utility.html,sha256=3flZinKNqUJ7pvrZk6xu__v67z44rXnaK7UTZ303R-8,16946
66
- GameSentenceMiner/wip/get_overlay_coords.py,sha256=dzP8EbexXuRnSEP4lWUzyMn24B9UQkAGA6zbxGS_W2M,9506
67
- gamesentenceminer-2.12.0.dev6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
68
- gamesentenceminer-2.12.0.dev6.dist-info/METADATA,sha256=DvW1QUhxzRIx2pQdp8JLrV7vPohTFPYd7pnM7INR27o,7004
69
- gamesentenceminer-2.12.0.dev6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
- gamesentenceminer-2.12.0.dev6.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
71
- gamesentenceminer-2.12.0.dev6.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
72
- gamesentenceminer-2.12.0.dev6.dist-info/RECORD,,
66
+ GameSentenceMiner/wip/get_overlay_coords.py,sha256=2y3z44b4v1sdqfOdoRD-eSE72i_fRiH6oJaYAZY2bGo,9666
67
+ gamesentenceminer-2.12.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
68
+ gamesentenceminer-2.12.1.dist-info/METADATA,sha256=8XwodhYZi4oQLUVsg5d-mvByYnpDOA-Q_YbAAzcDuIY,6999
69
+ gamesentenceminer-2.12.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
+ gamesentenceminer-2.12.1.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
71
+ gamesentenceminer-2.12.1.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
72
+ gamesentenceminer-2.12.1.dist-info/RECORD,,