Api
Labelprop Index / Labelprop / Api
Auto-generated documentation for labelprop.api module.
- Api
- check
- check_tmp
- create_buf_npz
- download_inference
- get_ckpt_dir
- get_session_info
- get_session_list
- get_tmp_hashed_img
- hash_array
- inference
- list_ckpts
- list_hashes
- send_ckpt
- set_ckpt_dir
- timer
- training
check
Signature
@app.route("/check", methods=["GET"])
def check(): ...
check_tmp
Check if /tmp directory exists, if not create it (watch out for permissions in Windows)
Signature
def check_tmp(): ...
create_buf_npz
Create a compressed NumPy .npz file from a dictionary of arrays.
Arguments
array_dictdict - A dictionary containing arrays to be saved in the .npz file.
Returns
io.BytesIO- A BytesIO object containing the compressed .npz file.
Signature
def create_buf_npz(array_dict): ...
download_inference
Return the inference results as a zip file.
Signature
@app.route("/download_inference", methods=["GET", "POST"])
def download_inference(): ...
get_ckpt_dir
Signature
@app.route("/get_ckpt_dir", methods=["GET"])
def get_ckpt_dir(): ...
get_session_info
Return the session info for a given token.
Signature
@app.route("/get_session_info", methods=["GET"])
def get_session_info(): ...
get_session_list
Return a list of all tokens.
Signature
@app.route("/get_session_list", methods=["GET"])
def get_session_list(): ...
get_tmp_hashed_img
List hash from file of /tmp directory
Hased images are named as "
Signature
def get_tmp_hashed_img(): ...
hash_array
Signature
@timer
def hash_array(array): ...
See also
inference
Perform inference using the LabelProp model.
This function loads the necessary input data, processes it, and returns the inference results.
It saves the input image and mask to the temporary folder, and then calls the propagate_from_ckpt function
to perform the inference. The results are stored in a session dictionary.
Returns
responseResponse - The response object containing the session token.
Signature
@app.route("/inference", methods=["POST"])
def inference(): ...
list_ckpts
Return a list of all checkpoints in the checkpoint_dir.
Signature
@app.route("/list_ckpts", methods=["GET"])
def list_ckpts(): ...
list_hashes
Return a list of all hash in the sessions dictionnary from get_tmp_hashed_img().
Signature
@app.route("/list_hash", methods=["GET"])
def list_hashes(): ...
send_ckpt
Receive a checkpoint file and save it in the checkpoint_dir.
Signature
@app.route("/send_ckpt", methods=["POST"])
def send_ckpt(): ...
set_ckpt_dir
Signature
@app.route("/set_ckpt_dir", methods=["POST"])
def set_ckpt_dir(): ...
timer
Decorator that measures the execution time of a function.
Arguments
func- The function to be timed.
Returns
The wrapped function.
Signature
def timer(func): ...
training
This function performs the training process for the labelprop module.
It loads the necessary arrays and parameters from the request files, checks for temporary files,
and prepares the input data for training. It then calls the train_and_infer function to perform
the training and inference process. Finally, it saves the results and returns a response token.
Returns
responseResponse - The response object containing the token.
Raises
Exception- If an error occurs during the training process.
Signature
@app.route("/training", methods=["POST"])
def training(): ...