From a53d60dbe1c5299aac660c227cdcff933e506788 Mon Sep 17 00:00:00 2001 From: wuzekai <3025054974@qq.com> Date: Tue, 8 Jul 2025 05:19:48 +0000 Subject: [PATCH] Update ocr.py --- ocr.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ocr.py b/ocr.py index 1a54ce2..ec36150 100644 --- a/ocr.py +++ b/ocr.py @@ -27,4 +27,10 @@ def ocr_inference(): file = request.files["file"] if file.filename == "": - return jsonify({"error": "No selected file"}), 400 \ No newline at end of file + return jsonify({"error": "No selected file"}), 400 + + # 生成唯一文件名 + uuid_str = str(uuid.uuid4()) + filename = f"{uuid_str}.jpg" + image_path = os.path.join(upload_dir, filename) + file.save(image_path) \ No newline at end of file -- 2.22.0