Spaces:
Sleeping
Sleeping
Alexandre Gazola
commited on
Commit
·
1b0b6ed
1
Parent(s):
4082859
ajuste FEN
Browse files
chess_image_to_fen_tool.py
CHANGED
@@ -26,7 +26,7 @@ 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 |
base64_image = get_base64(image_path_in_base64)
|
29 |
-
|
30 |
if not base64_image:
|
31 |
raise ValueError("Failed to encode image to base64.")
|
32 |
base64_image_encoded = f"data:image/jpeg;base64,{base64_image}"
|
@@ -34,7 +34,7 @@ def chess_image_to_fen(image_path_in_base64:str, current_player: Literal["black"
|
|
34 |
payload = {
|
35 |
"board_orientation": "predict",
|
36 |
"cropped": False,
|
37 |
-
"current_player":
|
38 |
"image": base64_image_encoded,
|
39 |
"predict_turn": False
|
40 |
}
|
@@ -50,4 +50,5 @@ def chess_image_to_fen(image_path_in_base64:str, current_player: Literal["black"
|
|
50 |
else:
|
51 |
raise Exception("Requisição feita, mas falhou na predição.")
|
52 |
else:
|
|
|
53 |
raise Exception(f"Erro na requisição: {response.status_code}")
|
|
|
26 |
raise ValueError("current_player must be 'black' or 'white'")
|
27 |
|
28 |
base64_image = get_base64(image_path_in_base64)
|
29 |
+
|
30 |
if not base64_image:
|
31 |
raise ValueError("Failed to encode image to base64.")
|
32 |
base64_image_encoded = f"data:image/jpeg;base64,{base64_image}"
|
|
|
34 |
payload = {
|
35 |
"board_orientation": "predict",
|
36 |
"cropped": False,
|
37 |
+
"current_player": current_player,
|
38 |
"image": base64_image_encoded,
|
39 |
"predict_turn": False
|
40 |
}
|
|
|
50 |
else:
|
51 |
raise Exception("Requisição feita, mas falhou na predição.")
|
52 |
else:
|
53 |
+
print(response.text)
|
54 |
raise Exception(f"Erro na requisição: {response.status_code}")
|