Skip to content

Commit 047a43d

Browse files
committed
save
1 parent 21c588e commit 047a43d

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/image_gen/http_image_gen_calculator.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include "../http_payload.hpp"
2626
#include "../logging.hpp"
2727

28+
#include "pipelines.hpp"
29+
2830
using namespace ovms;
2931

3032
namespace mediapipe {
@@ -40,6 +42,7 @@ class ImageGenCalculator : public CalculatorBase {
4042
RET_CHECK(!cc->Inputs().GetTags().empty());
4143
RET_CHECK(!cc->Outputs().GetTags().empty());
4244
cc->Inputs().Tag(INPUT_TAG_NAME).Set<ovms::HttpPayload>();
45+
cc->InputSidePackets().Tag(IMAGE_GEN_SESSION_SIDE_PACKET_TAG).Set<std::unordered_map<std::string, std::shared_ptr<ovms::ImageGenerationPipelines>>>(); // TODO: template?
4346
cc->Outputs().Tag(OUTPUT_TAG_NAME).Set<std::string>();
4447
return absl::OkStatus();
4548
}

src/mediapipe_internal/mediapipegraphdefinition.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ Status MediapipeGraphDefinition::create(std::shared_ptr<MediapipeGraphExecutor>&
265265

266266
pipeline = std::make_shared<MediapipeGraphExecutor>(getName(), std::to_string(getVersion()),
267267
this->config, this->inputTypes, this->outputTypes, this->inputNames, this->outputNames,
268-
this->pythonNodeResourcesMap, this->genAiServableMap, this->pythonBackend, this->reporter.get());
268+
this->pythonNodeResourcesMap, this->genAiServableMap, this->imageGenerationPipelinesMap,
269+
this->pythonBackend, this->reporter.get());
269270
return status;
270271
}
271272

src/mediapipe_internal/mediapipegraphexecutor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include "../python/python_backend.hpp"
3232
#endif
3333

34+
#include "../image_gen/pipelines.hpp"
35+
3436
namespace ovms {
3537

3638
MediapipeGraphExecutor::MediapipeGraphExecutor(
@@ -43,6 +45,7 @@ MediapipeGraphExecutor::MediapipeGraphExecutor(
4345
std::vector<std::string> outputNames,
4446
const PythonNodeResourcesMap& pythonNodeResourcesMap,
4547
const GenAiServableMap& llmNodeResourcesMap,
48+
const ImageGenerationPipelinesMap& imageGenPipelinesMap,
4649
PythonBackend* pythonBackend,
4750
MediapipeServableMetricReporter* mediapipeServableMetricReporter) :
4851
name(name),
@@ -54,6 +57,7 @@ MediapipeGraphExecutor::MediapipeGraphExecutor(
5457
outputNames(std::move(outputNames)),
5558
pythonNodeResourcesMap(pythonNodeResourcesMap),
5659
llmNodeResourcesMap(llmNodeResourcesMap),
60+
imageGenPipelinesMap(imageGenPipelinesMap),
5761
pythonBackend(pythonBackend),
5862
currentStreamTimestamp(STARTING_TIMESTAMP),
5963
mediapipeServableMetricReporter(mediapipeServableMetricReporter) {}

src/mediapipe_internal/mediapipegraphexecutor.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class MediapipeGraphExecutor {
8282

8383
PythonNodeResourcesMap pythonNodeResourcesMap;
8484
GenAiServableMap llmNodeResourcesMap;
85+
ImageGenerationPipelinesMap imageGenPipelinesMap;
8586
PythonBackend* pythonBackend;
8687

8788
::mediapipe::Timestamp currentStreamTimestamp;
@@ -100,6 +101,7 @@ class MediapipeGraphExecutor {
100101
std::vector<std::string> inputNames, std::vector<std::string> outputNames,
101102
const PythonNodeResourcesMap& pythonNodeResourcesMap,
102103
const GenAiServableMap& llmNodeResourcesMap,
104+
const ImageGenerationPipelinesMap& imageGenPipelinesMap,
103105
PythonBackend* pythonBackend,
104106
MediapipeServableMetricReporter* mediapipeServableMetricReporter);
105107

@@ -137,6 +139,9 @@ class MediapipeGraphExecutor {
137139
inputSidePackets[PYTHON_SESSION_SIDE_PACKET_TAG] = mediapipe::MakePacket<PythonNodeResourcesMap>(this->pythonNodeResourcesMap).At(STARTING_TIMESTAMP);
138140
inputSidePackets[LLM_SESSION_SIDE_PACKET_TAG] = mediapipe::MakePacket<GenAiServableMap>(this->llmNodeResourcesMap).At(STARTING_TIMESTAMP);
139141
#endif
142+
inputSidePackets[IMAGE_GEN_SESSION_SIDE_PACKET_TAG] = mediapipe::MakePacket<ImageGenerationPipelinesMap>(this->imageGenPipelinesMap).At(STARTING_TIMESTAMP);
143+
// TODO: Add for streaming?
144+
140145
MP_RETURN_ON_FAIL(graph.StartRun(inputSidePackets), std::string("start MediaPipe graph: ") + this->name, StatusCode::MEDIAPIPE_GRAPH_START_ERROR);
141146

142147
::mediapipe::Packet packet;

0 commit comments

Comments
 (0)