Create main.py
Browse files
main.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI, HTTPException
|
2 |
+
from typing import List
|
3 |
+
import uvicorn
|
4 |
+
|
5 |
+
app = FastAPI()
|
6 |
+
stored_array = None # Global variable to hold the array
|
7 |
+
|
8 |
+
@app.post("/send-array")
|
9 |
+
async def send_array(array: List[List[List[List[int]]]]):
|
10 |
+
global stored_array
|
11 |
+
stored_array = array
|
12 |
+
return {"message": "Array stored successfully"}
|
13 |
+
|
14 |
+
@app.get("/get-array")
|
15 |
+
async def get_array():
|
16 |
+
if stored_array is None:
|
17 |
+
raise HTTPException(status_code=404, detail="No array found")
|
18 |
+
return {"array": stored_array}
|
19 |
+
|
20 |
+
if __name__ == "__main__":
|
21 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|