Spaces:
Sleeping
Sleeping
Commit
·
2b1a623
1
Parent(s):
25797e0
new code
Browse files
main.py
CHANGED
|
@@ -6,6 +6,7 @@ import time
|
|
| 6 |
import pandas as pd
|
| 7 |
import tempfile
|
| 8 |
from google.cloud import storage
|
|
|
|
| 9 |
|
| 10 |
app = FastAPI()
|
| 11 |
|
|
@@ -66,11 +67,16 @@ def stop_reading_thread():
|
|
| 66 |
if reading_thread is not None:
|
| 67 |
reading_thread.join()
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
| 71 |
global reading_thread
|
| 72 |
global stop_reading
|
| 73 |
|
|
|
|
|
|
|
| 74 |
if location not in ["tambaram", "velachery"]:
|
| 75 |
return {"error": "Invalid location"}
|
| 76 |
|
|
|
|
| 6 |
import pandas as pd
|
| 7 |
import tempfile
|
| 8 |
from google.cloud import storage
|
| 9 |
+
from pydantic import BaseModel
|
| 10 |
|
| 11 |
app = FastAPI()
|
| 12 |
|
|
|
|
| 67 |
if reading_thread is not None:
|
| 68 |
reading_thread.join()
|
| 69 |
|
| 70 |
+
class LocationRequest(BaseModel):
|
| 71 |
+
location: str
|
| 72 |
+
|
| 73 |
+
@app.post("/update_location/")
|
| 74 |
+
async def update_location(location_request: LocationRequest):
|
| 75 |
global reading_thread
|
| 76 |
global stop_reading
|
| 77 |
|
| 78 |
+
location = location_request.location
|
| 79 |
+
|
| 80 |
if location not in ["tambaram", "velachery"]:
|
| 81 |
return {"error": "Invalid location"}
|
| 82 |
|