Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -25,11 +25,13 @@ def read_root():
|
|
25 |
|
26 |
@app.post("/upload")
|
27 |
async def upload_file(file: UploadFile = File(...)):
|
|
|
28 |
# 定义文件存储路径和名称
|
29 |
file_location = os.path.join(UPLOAD_DIRECTORY, file.filename)
|
30 |
|
31 |
# 将上传的文件写入本地文件系统
|
32 |
with open(file_location, "wb") as buffer:
|
|
|
33 |
buffer.write(await file.read())
|
34 |
|
35 |
return {"info": f"file '{file.filename}' saved at '{file_location}'"}
|
|
|
25 |
|
26 |
@app.post("/upload")
|
27 |
async def upload_file(file: UploadFile = File(...)):
|
28 |
+
print(f'收到请求 {file.filename}')
|
29 |
# 定义文件存储路径和名称
|
30 |
file_location = os.path.join(UPLOAD_DIRECTORY, file.filename)
|
31 |
|
32 |
# 将上传的文件写入本地文件系统
|
33 |
with open(file_location, "wb") as buffer:
|
34 |
+
print(f'写入本地文件 {file.filename}')
|
35 |
buffer.write(await file.read())
|
36 |
|
37 |
return {"info": f"file '{file.filename}' saved at '{file_location}'"}
|