refactor: doc

This commit is contained in:
yi_t
2025-03-27 14:05:30 +08:00
parent 118891e187
commit e50a0c83b6
2 changed files with 18 additions and 0 deletions
+6
View File
@@ -123,6 +123,12 @@ if __name__ == "__main__":
# result = ocr_recognize(image_url="https://example.com/image.png")
```
### test
```bash
bash test.sh
```
## Project Structure
- `main.py`: The Flask API service that handles OCR requests
+12
View File
@@ -69,6 +69,18 @@ def index():
return render_template("index.html")
# Handle unsupported methods for /ocr route
@app.route("/ocr", methods=["GET", "PUT", "DELETE", "PATCH"])
def unsupported_method():
return jsonify({"error": "Method not allowed"}), 405
# Handle non-existent paths
@app.errorhandler(404)
def not_found(e):
return jsonify({"error": "Resource not found"}), 404
if __name__ == "__main__":
# 确保templates目录存在
templates_dir = os.path.join(