Spaces:
Sleeping
Sleeping
Alexandre Gazola
commited on
Commit
·
992c62f
1
Parent(s):
35318a3
fix
Browse files
chess_image_to_fen_tool.py
CHANGED
|
@@ -4,6 +4,7 @@ from utils import get_base64
|
|
| 4 |
from typing import Literal, Dict
|
| 5 |
from utils import get_base64
|
| 6 |
import requests
|
|
|
|
| 7 |
|
| 8 |
@tool
|
| 9 |
def chess_image_to_fen(image_path_in_base64:str, current_player: Literal["black", "white"]) -> Dict[str,str]:
|
|
@@ -26,7 +27,9 @@ def chess_image_to_fen(image_path_in_base64:str, current_player: Literal["black"
|
|
| 26 |
raise ValueError("current_player must be 'black' or 'white'")
|
| 27 |
|
| 28 |
print('Reading chess image in base 64: ' + image_path_in_base64)
|
| 29 |
-
base64_image = get_base64(image_path_in_base64)
|
|
|
|
|
|
|
| 30 |
|
| 31 |
if not base64_image:
|
| 32 |
raise ValueError("Failed to encode image to base64.")
|
|
|
|
| 4 |
from typing import Literal, Dict
|
| 5 |
from utils import get_base64
|
| 6 |
import requests
|
| 7 |
+
import json
|
| 8 |
|
| 9 |
@tool
|
| 10 |
def chess_image_to_fen(image_path_in_base64:str, current_player: Literal["black", "white"]) -> Dict[str,str]:
|
|
|
|
| 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 |
|
| 34 |
if not base64_image:
|
| 35 |
raise ValueError("Failed to encode image to base64.")
|