MarioPrzBasto commited on
Commit
51dcd2c
·
verified ·
1 Parent(s): 246e9c9

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -5
main.py CHANGED
@@ -10,12 +10,11 @@ app = FastAPI()
10
  BASE_DIR = "/tmp/data"
11
 
12
  @app.post("/save")
13
- async def save(images: List[RequestModel]):
14
  os.makedirs(BASE_DIR, exist_ok=True)
15
- for image_data in images:
16
- filename = os.path.join(BASE_DIR, f"{image_data.originId}_{image_data.assetCode}.json")
17
- with open(filename, "w") as f:
18
- json.dump(image_data.dict(), f, indent=4)
19
  return True
20
 
21
  @app.get("/files")
 
10
  BASE_DIR = "/tmp/data"
11
 
12
  @app.post("/save")
13
+ async def save(image_data: RequestModel):
14
  os.makedirs(BASE_DIR, exist_ok=True)
15
+ filename = os.path.join(BASE_DIR, f"{image_data.originId}_{image_data.assetCode}.json")
16
+ with open(filename, "w") as f:
17
+ json.dump(image_data.dict(), f, indent=4)
 
18
  return True
19
 
20
  @app.get("/files")