Spaces:
Sleeping
Sleeping
Upload game_engine.py
Browse files- game_engine.py +9 -27
game_engine.py
CHANGED
|
@@ -57,39 +57,21 @@ if is_zerogpu:
|
|
| 57 |
from simple_gpu import gpu_dummy_function
|
| 58 |
print("✅ Simple GPU importé")
|
| 59 |
|
| 60 |
-
# Utiliser
|
| 61 |
-
from
|
| 62 |
-
recognize_number_fast_with_image as
|
| 63 |
create_thumbnail_fast,
|
| 64 |
create_white_canvas,
|
| 65 |
cleanup_memory,
|
| 66 |
-
log_memory_usage
|
|
|
|
| 67 |
)
|
| 68 |
|
| 69 |
-
#
|
| 70 |
-
|
| 71 |
-
print(f"🔍 OCR Wrapper appelé avec {len(args)} args")
|
| 72 |
-
if len(args) > 0:
|
| 73 |
-
image = args[0]
|
| 74 |
-
print(f"🔍 Type image reçue: {type(image)}")
|
| 75 |
-
if hasattr(image, 'size'):
|
| 76 |
-
print(f"🔍 Taille image: {image.size}")
|
| 77 |
-
elif isinstance(image, dict):
|
| 78 |
-
print(f"🔍 Keys dict image: {list(image.keys())}")
|
| 79 |
-
|
| 80 |
-
result = cpu_recognize(*args, **kwargs)
|
| 81 |
-
print(f"🔍 Résultat OCR brut: {result}")
|
| 82 |
-
return result
|
| 83 |
-
|
| 84 |
-
def get_ocr_model_info():
|
| 85 |
-
return {
|
| 86 |
-
"model_name": "EasyOCR-ZeroGPU",
|
| 87 |
-
"device": "ZeroGPU",
|
| 88 |
-
"framework": "EasyOCR-ZeroGPU-Mode"
|
| 89 |
-
}
|
| 90 |
|
| 91 |
-
ocr_module = "
|
| 92 |
-
print("✅ Game Engine: Mode ZeroGPU -
|
| 93 |
|
| 94 |
except Exception as e:
|
| 95 |
print(f"❌ Erreur ZeroGPU: {e}")
|
|
|
|
| 57 |
from simple_gpu import gpu_dummy_function
|
| 58 |
print("✅ Simple GPU importé")
|
| 59 |
|
| 60 |
+
# Utiliser le vrai TrOCR qu'on a chargé !
|
| 61 |
+
from image_processing_gpu import (
|
| 62 |
+
recognize_number_fast_with_image as gpu_recognize,
|
| 63 |
create_thumbnail_fast,
|
| 64 |
create_white_canvas,
|
| 65 |
cleanup_memory,
|
| 66 |
+
log_memory_usage,
|
| 67 |
+
get_ocr_model_info
|
| 68 |
)
|
| 69 |
|
| 70 |
+
# Pas de wrapper, utiliser directement TrOCR
|
| 71 |
+
recognize_number_fast_with_image = gpu_recognize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
ocr_module = "zerogpu_trocr"
|
| 74 |
+
print("✅ Game Engine: Mode ZeroGPU - TrOCR directement utilisé")
|
| 75 |
|
| 76 |
except Exception as e:
|
| 77 |
print(f"❌ Erreur ZeroGPU: {e}")
|