rogerxavier commited on
Commit
49567b1
1 Parent(s): 06a0cd9

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +13 -2
api.py CHANGED
@@ -31,12 +31,23 @@ def t5():
31
 
32
  @app.post("/getOriginalMangaList")
33
  async def getOriginalMangaList(images: List[UploadFile] = File(...)):
34
-
35
  for idx, image in enumerate(images):
36
  img = await image.read()
37
  image = Image.open(io.BytesIO(img)).convert("L").convert("RGB")
38
  path_to_image = f"/manga/{idx}.jpg"
39
  image.save(path_to_image)
40
-
41
  return "获取图片保存成功"
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
 
31
 
32
  @app.post("/getOriginalMangaList")
33
  async def getOriginalMangaList(images: List[UploadFile] = File(...)):
 
34
  for idx, image in enumerate(images):
35
  img = await image.read()
36
  image = Image.open(io.BytesIO(img)).convert("L").convert("RGB")
37
  path_to_image = f"/manga/{idx}.jpg"
38
  image.save(path_to_image)
 
39
  return "获取图片保存成功"
40
+
41
+
42
+ @app.delete("/deleteAllMangaFiles")
43
+ async def delete_all_manga_files():
44
+ directory = "manga"
45
+ for filename in os.listdir(directory):
46
+ file_path = os.path.join(directory, filename)
47
+ if os.path.isfile(file_path):
48
+ os.remove(file_path)
49
+
50
+ return {"message": "成功删除manga目录下的所有文件"}
51
+
52
+
53