Skip to content

Commit a141d7d

Browse files
committed
GenerationRequest API
1 parent a3d1ccb commit a141d7d

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

samples/cpp/image_generation/text2image.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,19 @@ int32_t main(int32_t argc, char* argv[]) try {
2424
ov::genai::height(512),
2525
ov::genai::num_inference_steps(20),
2626
ov::genai::num_images_per_prompt(1)},
27-
28-
1);
29-
//ov::genai::callback(progress_bar));
27+
1); // request_idx
28+
29+
// TODO: GenerationRequest will wrap request_idx
30+
/*
31+
Text2ImagePipeline::GenerationRequest request = pipeline.create_generation_request(); // assigns new free request_idx
32+
33+
// Sync (would be used in OVMS)
34+
ov::Tensor image = request.generate("happy dog",
35+
ov::genai::width(512),
36+
ov::genai::height(512),
37+
ov::genai::num_inference_steps(20),
38+
ov::genai::num_images_per_prompt(1));
39+
*/
3040

3141
// writes `num_images_per_prompt` images by pattern name
3242
imwrite("image_2_%d.bmp", image, true);
@@ -39,13 +49,11 @@ int32_t main(int32_t argc, char* argv[]) try {
3949
std::cout << "Generating..." << std::endl;
4050
ov::Tensor image = pipe.generate("black cat",
4151
ov::AnyMap{
42-
ov::genai::width(512),
43-
ov::genai::height(512),
52+
ov::genai::width(256),
53+
ov::genai::height(256),
4454
ov::genai::num_inference_steps(20),
4555
ov::genai::num_images_per_prompt(1)},
46-
4756
2);
48-
//ov::genai::callback(progress_bar));
4957

5058
// writes `num_images_per_prompt` images by pattern name
5159
imwrite("image_1_%d.bmp", image, true);

0 commit comments

Comments
 (0)