Spaces:
Sleeping
Sleeping
Commit ·
7ffa183
1
Parent(s): 703e27a
Deploy fixed backend code
Browse files- src/dependencies.py +1 -1
- src/tasks/ocr_tasks.py +4 -4
src/dependencies.py
CHANGED
|
@@ -48,7 +48,7 @@ async def init_supabase() -> None:
|
|
| 48 |
async def close_supabase() -> None:
|
| 49 |
global _supabase_client
|
| 50 |
if _supabase_client:
|
| 51 |
-
|
| 52 |
_supabase_client = None
|
| 53 |
|
| 54 |
|
|
|
|
| 48 |
async def close_supabase() -> None:
|
| 49 |
global _supabase_client
|
| 50 |
if _supabase_client:
|
| 51 |
+
pass
|
| 52 |
_supabase_client = None
|
| 53 |
|
| 54 |
|
src/tasks/ocr_tasks.py
CHANGED
|
@@ -17,7 +17,7 @@ async def _load_batch_context(batch_id: str) -> dict:
|
|
| 17 |
|
| 18 |
from ..config import settings
|
| 19 |
|
| 20 |
-
supabase = await acreate_client(settings.SUPABASE_URL, settings.SUPABASE_SERVICE_KEY)
|
| 21 |
try:
|
| 22 |
batch_res = await (
|
| 23 |
supabase.table("batches").select("*").eq("id", batch_id).single().execute()
|
|
@@ -43,7 +43,7 @@ async def _load_batch_context(batch_id: str) -> dict:
|
|
| 43 |
]
|
| 44 |
return {"batch": batch, "documents": documents}
|
| 45 |
finally:
|
| 46 |
-
|
| 47 |
|
| 48 |
|
| 49 |
async def _persist_graph_result(batch_id: str, result: dict) -> None:
|
|
@@ -52,7 +52,7 @@ async def _persist_graph_result(batch_id: str, result: dict) -> None:
|
|
| 52 |
|
| 53 |
from ..config import settings
|
| 54 |
|
| 55 |
-
supabase = await acreate_client(settings.SUPABASE_URL, settings.SUPABASE_SERVICE_KEY)
|
| 56 |
try:
|
| 57 |
await supabase.table("extracted_fields").delete().eq("batch_id", batch_id).execute()
|
| 58 |
await supabase.table("validation_results").delete().eq("batch_id", batch_id).execute()
|
|
@@ -104,7 +104,7 @@ async def _persist_graph_result(batch_id: str, result: dict) -> None:
|
|
| 104 |
"langgraph_thread_id": batch_id,
|
| 105 |
}).eq("id", batch_id).execute()
|
| 106 |
finally:
|
| 107 |
-
|
| 108 |
|
| 109 |
|
| 110 |
def _average_confidence(confidences: dict) -> float:
|
|
|
|
| 17 |
|
| 18 |
from ..config import settings
|
| 19 |
|
| 20 |
+
supabase = await acreate_client(settings.SUPABASE_URL, settings.SUPABASE_SERVICE_KEY.get_secret_value())
|
| 21 |
try:
|
| 22 |
batch_res = await (
|
| 23 |
supabase.table("batches").select("*").eq("id", batch_id).single().execute()
|
|
|
|
| 43 |
]
|
| 44 |
return {"batch": batch, "documents": documents}
|
| 45 |
finally:
|
| 46 |
+
pass
|
| 47 |
|
| 48 |
|
| 49 |
async def _persist_graph_result(batch_id: str, result: dict) -> None:
|
|
|
|
| 52 |
|
| 53 |
from ..config import settings
|
| 54 |
|
| 55 |
+
supabase = await acreate_client(settings.SUPABASE_URL, settings.SUPABASE_SERVICE_KEY.get_secret_value())
|
| 56 |
try:
|
| 57 |
await supabase.table("extracted_fields").delete().eq("batch_id", batch_id).execute()
|
| 58 |
await supabase.table("validation_results").delete().eq("batch_id", batch_id).execute()
|
|
|
|
| 104 |
"langgraph_thread_id": batch_id,
|
| 105 |
}).eq("id", batch_id).execute()
|
| 106 |
finally:
|
| 107 |
+
pass
|
| 108 |
|
| 109 |
|
| 110 |
def _average_confidence(confidences: dict) -> float:
|