Skip to content

Commit 6565cf3

Browse files
committed
GenerationRequest API
1 parent a3d1ccb commit 6565cf3

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

samples/cpp/image_generation/text2image.cpp

+23-7
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,27 @@ 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+
40+
// Async
41+
request.generate_async("happy dog",
42+
ov::genai::width(512),
43+
ov::genai::height(512),
44+
ov::genai::num_inference_steps(20),
45+
ov::genai::num_images_per_prompt(1));
46+
ov::Tensor image = request.wait();
47+
*/
3048

3149
// writes `num_images_per_prompt` images by pattern name
3250
imwrite("image_2_%d.bmp", image, true);
@@ -39,13 +57,11 @@ int32_t main(int32_t argc, char* argv[]) try {
3957
std::cout << "Generating..." << std::endl;
4058
ov::Tensor image = pipe.generate("black cat",
4159
ov::AnyMap{
42-
ov::genai::width(512),
43-
ov::genai::height(512),
60+
ov::genai::width(256),
61+
ov::genai::height(256),
4462
ov::genai::num_inference_steps(20),
4563
ov::genai::num_images_per_prompt(1)},
46-
4764
2);
48-
//ov::genai::callback(progress_bar));
4965

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

0 commit comments

Comments
 (0)