v / main.py
navpan2's picture
Create main.py
b47bc59 verified
raw
history blame
598 Bytes
from fastapi import FastAPI, HTTPException
from typing import List
import uvicorn
app = FastAPI()
stored_array = None # Global variable to hold the array
@app.post("/send-array")
async def send_array(array: List[List[List[List[int]]]]):
global stored_array
stored_array = array
return {"message": "Array stored successfully"}
@app.get("/get-array")
async def get_array():
if stored_array is None:
raise HTTPException(status_code=404, detail="No array found")
return {"array": stored_array}
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=7860)