Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)



find_path(QVAC_LIB_INFERENCE_ADDON_CPP_INCLUDE_DIRS "qvac-lib-inference-addon-cpp/Addon.hpp")
find_path(QVAC_LIB_INFERENCE_ADDON_CPP_INCLUDE_DIRS "qvac-lib-inference-addon-cpp/JsInterface.hpp")
find_package(OpenCV REQUIRED)
find_package(onnxruntime CONFIG REQUIRED)

Expand All @@ -113,9 +113,7 @@ add_bare_module(qvac-lib-inference-addon-onnx-ocr-fasttext EXPORTS)
target_sources(
${qvac-lib-inference-addon-onnx-ocr-fasttext}
PRIVATE
addon/addon/Addon.cpp
addon/js-interface/binding.cpp
addon/js-interface/qvac-lib-inference-addon-onnx-ocr-fasttext.cpp
addon/pipeline/Lang.cpp
addon/pipeline/Pipeline.cpp
addon/pipeline/Steps.cpp
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#pragma once

#include <memory>

#include <qvac-lib-inference-addon-cpp/ModelInterfaces.hpp>
#include <qvac-lib-inference-addon-cpp/addon/AddonCpp.hpp>
#include <qvac-lib-inference-addon-cpp/handlers/OutputHandler.hpp>
#include <qvac-lib-inference-addon-cpp/queue/OutputCallbackCpp.hpp>
#include <qvac-lib-inference-addon-cpp/queue/OutputCallbackInterface.hpp>

#include "pipeline/Pipeline.hpp"

namespace qvac_lib_inference_addon_onnx_ocr_fasttext {

struct AddonInstance {
std::unique_ptr<qvac_lib_inference_addon_cpp::AddonCpp> addon;
std::shared_ptr<qvac_lib_inference_addon_cpp::out_handl::
CppQueuedOutputHandler<Pipeline::Output>>
outputHandler;
};

/// @brief Creates a pure C++ Addon (no Js dependencies). Can be used on CLI or
/// C++ tests.
inline AddonInstance createInstance(
const ORTCHAR_T* pathDetector, const ORTCHAR_T* pathRecognizer,
std::span<const std::string> langList, bool useGPU = true,
int timeout = Pipeline::DEFAULT_PIPELINE_TIMEOUT_SECONDS,
const Pipeline::Config& config = Pipeline::Config{}) {
using namespace qvac_lib_inference_addon_cpp;
using namespace std;

auto model = make_unique<Pipeline>(
pathDetector, pathRecognizer, langList, useGPU, timeout, config);

auto outHandler =
make_shared<out_handl::CppQueuedOutputHandler<Pipeline::Output>>();
out_handl::OutputHandlers<out_handl::OutputHandlerInterface<void>>
outHandlers;
outHandlers.add(outHandler);
unique_ptr<OutputCallBackInterface> callback =
make_unique<OutputCallBackCpp>(std::move(outHandlers));

auto addon = make_unique<AddonCpp>(std::move(callback), std::move(model));

return {std::move(addon), std::move(outHandler)};
}
} // namespace qvac_lib_inference_addon_onnx_ocr_fasttext
Loading
Loading