Alexandre Gazola commited on
Commit
abffb61
·
1 Parent(s): 25013ae
Files changed (2) hide show
  1. chess_image_to_fen_tool.py +1 -1
  2. utils.py +3 -2
chess_image_to_fen_tool.py CHANGED
@@ -27,7 +27,7 @@ def chess_image_to_fen(image_path_in_base64:str, current_player: Literal["black"
27
  raise ValueError("current_player must be 'black' or 'white'")
28
 
29
  print('Reading chess image in base 64: ' + image_path_in_base64)
30
- base64_image = get_base64(image_path_in_base64).strip()
31
 
32
  print("content in base64:\n\n" + base64_image)
33
 
 
27
  raise ValueError("current_player must be 'black' or 'white'")
28
 
29
  print('Reading chess image in base 64: ' + image_path_in_base64)
30
+ base64_image = get_base64(image_path_in_base64)
31
 
32
  print("content in base64:\n\n" + base64_image)
33
 
utils.py CHANGED
@@ -51,5 +51,6 @@ def clean_text(text: str) -> str:
51
  return text.encode("ascii", errors="ignore").decode()
52
 
53
  def get_base64(path: str) -> str:
54
- with open(path, "r") as f:
55
- return base64.b64encode(f.read()).decode("utf-8")
 
 
51
  return text.encode("ascii", errors="ignore").decode()
52
 
53
  def get_base64(path: str) -> str:
54
+ with open(file_path, "r", encoding="utf-8") as f:
55
+ base64_data = f.read().strip()
56
+ return base64_data