Python AlgoMarker API Server
This project provides a Python server wrapper for the AlgoMarker C library (libdyn_AlgoMarker.so). The wrapper allows you to interact with AlgoMarker using python code or as a server with a REST API. The server uses python FastAPI.
Location
You can find the Python library and a tool for querying AlgoMarkers in the MR_Tools at this folder $MR_Tools/AlgoMarker_python_API
Files
- AlgoMarker.py: Main Python wrapper for the C library. The wrapper will use the new JSON API if available, or fall back to the older API for compatibility. Can be also used directly without FastAPI with python code.
- test_algomarker_lib.py: Utility tool that uses
AlgoMarker.pyto query AlgoMarker. - AlgoMarker_minimal.py: Minimal version of the wrapper with fewer functions.
- simple_app_example.py: Example app demonstrating usage of the minimal wrapper.
Example Usage
Run the utility tool with:
--amlib(optional): Specify a custom library path.- If your request JSON includes
"data", you can run:
Simple Usage Example
Running as a FastAPI Server
You can also run the wrapper as a FastAPI server.
This will wrapper AlgoMarker.py
You will need to setup fastapi package with:
To configure, edit run_server.sh:
- Set
AM_CONFIGto the path of your AlgoMarker.amconfigfile. - Set
AM_LIBto the path of your compiled library (default is/lib/libdyn_AlgoMarker.soin the same directory as the amconfig file).
After editing, you can run the script.