Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -57,10 +57,11 @@ app = Flask(__name__)
|
|
57 |
# TESSERACT CONFIGURATION #
|
58 |
# ============================== #
|
59 |
# Set the Tesseract executable path
|
60 |
-
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
|
|
|
61 |
# Set the TESSDATA_PREFIX environment variable to the directory containing the 'tessdata' folder
|
62 |
# This is crucial for Tesseract to find its language data files (e.g., eng.traineddata)
|
63 |
-
os.environ['TESSDATA_PREFIX'] = r'C:\Program Files\Tesseract-OCR'
|
64 |
|
65 |
poppler_path = r"C:\poppler\Library\bin"
|
66 |
backdrop_images_path = r"blocks\Backdrops"
|
@@ -87,26 +88,26 @@ JSON_DIR = os.path.join("outputs", "EXTRACTED_JSON")
|
|
87 |
for d in (BLOCKS_DIR, STATIC_DIR, GEN_PROJECT_DIR, BACKDROP_DIR, SPRITE_DIR):
|
88 |
d.mkdir(parents=True, exist_ok=True)
|
89 |
|
90 |
-
def classify_image_type(description_or_name: str) -> str:
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
|
111 |
class GameState(TypedDict):
|
112 |
project_json: dict
|
|
|
57 |
# TESSERACT CONFIGURATION #
|
58 |
# ============================== #
|
59 |
# Set the Tesseract executable path
|
60 |
+
# pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
|
61 |
+
pytesseract.pytesseract.tesseract_cmd = (r'/usr/bin/tesseract')
|
62 |
# Set the TESSDATA_PREFIX environment variable to the directory containing the 'tessdata' folder
|
63 |
# This is crucial for Tesseract to find its language data files (e.g., eng.traineddata)
|
64 |
+
# os.environ['TESSDATA_PREFIX'] = r'C:\Program Files\Tesseract-OCR'
|
65 |
|
66 |
poppler_path = r"C:\poppler\Library\bin"
|
67 |
backdrop_images_path = r"blocks\Backdrops"
|
|
|
88 |
for d in (BLOCKS_DIR, STATIC_DIR, GEN_PROJECT_DIR, BACKDROP_DIR, SPRITE_DIR):
|
89 |
d.mkdir(parents=True, exist_ok=True)
|
90 |
|
91 |
+
# def classify_image_type(description_or_name: str) -> str:
|
92 |
+
# desc = description_or_name.lower()
|
93 |
+
|
94 |
+
# sprite_keywords = ["sprite", "character", "animal", "person", "creature", "robot", "figure"]
|
95 |
+
# backdrop_keywords = ["background", "scene", "forest", "city", "room", "sky", "mountain", "village"]
|
96 |
+
# code_block_keywords = [
|
97 |
+
# "move", "turn", "wait", "repeat", "if", "else", "broadcast",
|
98 |
+
# "glide", "change", "forever", "when", "switch", "costume",
|
99 |
+
# "say", "think", "stop", "clone", "touching", "sensing",
|
100 |
+
# "scratch", "block", "code", "set", "variable"
|
101 |
+
# ]
|
102 |
+
|
103 |
+
# if any(kw in desc for kw in code_block_keywords):
|
104 |
+
# return "code-block"
|
105 |
+
# elif any(kw in desc for kw in sprite_keywords):
|
106 |
+
# return "sprite"
|
107 |
+
# elif any(kw in desc for kw in backdrop_keywords):
|
108 |
+
# return "backdrop"
|
109 |
+
# else:
|
110 |
+
# return "unknown"
|
111 |
|
112 |
class GameState(TypedDict):
|
113 |
project_json: dict
|