1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use model::ModelWithConfig;
use pose_detector::PoseDetector;
use wasm_bindgen::JsValue;
use wasm_bindgen_futures::JsFuture;

mod bindings;
mod call_method;
pub mod model;
pub mod pose;
pub mod pose_detector;
pub mod util;

pub async fn create_detector(model: ModelWithConfig) -> Result<PoseDetector, JsValue> {
    let name = &model.get_name()[..];
    let config = model.get_config();
    let detector_js_value = JsFuture::from(bindings::create_detector(name, &config))
        .await
        .unwrap();
    Ok(PoseDetector::from(detector_js_value))
}