Spaces:
Running
Running
Update api/endpoints/location.py
Browse files
api/endpoints/location.py
CHANGED
@@ -2,6 +2,7 @@ from fastapi import APIRouter, HTTPException , Body,Query
|
|
2 |
from models.location_models import BodyData,ErrorResponse
|
3 |
from services.location_service import LocationService
|
4 |
import core.init_supabase as sp
|
|
|
5 |
router = APIRouter()
|
6 |
|
7 |
@router.post("/get_coordinates")
|
@@ -16,8 +17,9 @@ async def get_coordinates(user_id: str = Query(..., description="User's hush ID"
|
|
16 |
print("supabase data")
|
17 |
print(supabase_user_data)
|
18 |
coords=[]*len(supabase_user_data)
|
|
|
19 |
for cord in supabase_user_data:
|
20 |
-
result = LocationService.get_coordinates(cord)
|
21 |
coords.append(result)
|
22 |
if isinstance(result, ErrorResponse):
|
23 |
print(HTTPException(status_code=400, detail=result.error))
|
|
|
2 |
from models.location_models import BodyData,ErrorResponse
|
3 |
from services.location_service import LocationService
|
4 |
import core.init_supabase as sp
|
5 |
+
from .models.fastapi_globals import g
|
6 |
router = APIRouter()
|
7 |
|
8 |
@router.post("/get_coordinates")
|
|
|
17 |
print("supabase data")
|
18 |
print(supabase_user_data)
|
19 |
coords=[]*len(supabase_user_data)
|
20 |
+
model = g.ner_model
|
21 |
for cord in supabase_user_data:
|
22 |
+
result = LocationService.get_coordinates(cord,model)
|
23 |
coords.append(result)
|
24 |
if isinstance(result, ErrorResponse):
|
25 |
print(HTTPException(status_code=400, detail=result.error))
|