rogerxavier
commited on
Commit
•
0b32a98
1
Parent(s):
b9aff6d
Update api.py
Browse files
api.py
CHANGED
@@ -266,8 +266,8 @@ def get_cover_image():
|
|
266 |
|
267 |
#请求任意图片路径就返回这个路径的图片方便随时查看
|
268 |
|
269 |
-
@app.get("/get_image/{directory}/{file_name}")
|
270 |
-
def get_image(directory: str, file_name: str = Path(...)):
|
271 |
image_dir = f"/{directory}" # 指定子目录
|
272 |
file_path = os.path.join(image_dir, file_name)
|
273 |
return FileResponse(file_path)
|
|
|
266 |
|
267 |
#请求任意图片路径就返回这个路径的图片方便随时查看
|
268 |
|
269 |
+
@app.get("/get_image/{directory:path}/{file_name}")
|
270 |
+
def get_image(directory: str = Path(...), file_name: str = Path(...)):
|
271 |
image_dir = f"/{directory}" # 指定子目录
|
272 |
file_path = os.path.join(image_dir, file_name)
|
273 |
return FileResponse(file_path)
|