Spaces:
Sleeping
Sleeping
Commit ·
f1de4a9
1
Parent(s): 2886c3f
why am i
Browse files
__pycache__/main.cpython-313.pyc
CHANGED
|
Binary files a/__pycache__/main.cpython-313.pyc and b/__pycache__/main.cpython-313.pyc differ
|
|
|
main.py
CHANGED
|
@@ -15,6 +15,7 @@ import asyncio
|
|
| 15 |
import sys
|
| 16 |
import tracemalloc
|
| 17 |
from fastapi import requests
|
|
|
|
| 18 |
|
| 19 |
tracemalloc.start()
|
| 20 |
|
|
@@ -30,6 +31,9 @@ class DetectionResults(BaseModel):
|
|
| 30 |
confidences: list
|
| 31 |
classes: list
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
@app.get("/test")
|
| 35 |
async def read_root():
|
|
@@ -80,17 +84,17 @@ async def get_fen(file : UploadFile = File(), perspective : str = Form("w"), nex
|
|
| 80 |
return JSONResponse(content={"error": "Unexpected error occurred", "details": str(e)}, status_code=500)
|
| 81 |
|
| 82 |
@app.post('/getReview')
|
| 83 |
-
async def getReview(
|
| 84 |
print(os.getcwd())
|
| 85 |
print("call recieved")
|
| 86 |
|
| 87 |
-
if not
|
| 88 |
-
return JSONResponse(content={"error": "
|
| 89 |
-
|
| 90 |
try:
|
|
|
|
| 91 |
# Save the uploaded file to a temporary file
|
| 92 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pgn") as tmp_file:
|
| 93 |
-
tmp_file.write(
|
| 94 |
tmp_file_path = tmp_file.name
|
| 95 |
|
| 96 |
# Analyze the PGN file
|
|
|
|
| 15 |
import sys
|
| 16 |
import tracemalloc
|
| 17 |
from fastapi import requests
|
| 18 |
+
import base64
|
| 19 |
|
| 20 |
tracemalloc.start()
|
| 21 |
|
|
|
|
| 31 |
confidences: list
|
| 32 |
classes: list
|
| 33 |
|
| 34 |
+
class FileUpload(BaseModel):
|
| 35 |
+
file_data : str
|
| 36 |
+
|
| 37 |
|
| 38 |
@app.get("/test")
|
| 39 |
async def read_root():
|
|
|
|
| 84 |
return JSONResponse(content={"error": "Unexpected error occurred", "details": str(e)}, status_code=500)
|
| 85 |
|
| 86 |
@app.post('/getReview')
|
| 87 |
+
async def getReview(file_upload: FileUpload):
|
| 88 |
print(os.getcwd())
|
| 89 |
print("call recieved")
|
| 90 |
|
| 91 |
+
if not file_upload.file_data:
|
| 92 |
+
return JSONResponse(content={"error": "Empty file uploaded"}, status_code=400)
|
|
|
|
| 93 |
try:
|
| 94 |
+
file_data = base64.b64decode(file_upload.file_data)
|
| 95 |
# Save the uploaded file to a temporary file
|
| 96 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pgn") as tmp_file:
|
| 97 |
+
tmp_file.write(file_data)
|
| 98 |
tmp_file_path = tmp_file.name
|
| 99 |
|
| 100 |
# Analyze the PGN file
|
routes/__pycache__/chess_review.cpython-313.pyc
CHANGED
|
Binary files a/routes/__pycache__/chess_review.cpython-313.pyc and b/routes/__pycache__/chess_review.cpython-313.pyc differ
|
|
|