Skip to content

Commit

Permalink
Fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerBarreto committed Sep 24, 2024
1 parent a783563 commit 34da6a7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions dotnet/samples/Concepts/TextToImage/OpenAI_TextToImageDalle3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace TextToImage;
public class OpenAI_TextToImageDalle3(ITestOutputHelper output) : BaseTest(output)
{
[Fact]
public async Task OpenAIDallEAsync()
public async Task OpenAIDallE2Async()
{
Console.WriteLine("======== OpenAI DALL-E 2 Text To Image ========");

Expand All @@ -25,8 +25,8 @@ public async Task OpenAIDallEAsync()
ITextToImageService dallE = kernel.GetRequiredService<ITextToImageService>();

var imageDescription = "A cute baby sea otter";
var image = await dallE.GenerateImageAsync(imageDescription, 256, 256);

var images = await dallE.GetImageContentsAsync(imageDescription, new OpenAITextToImageExecutionSettings { Size = (256, 256) });
var image = images[0].Uri!.ToString();
Console.WriteLine(imageDescription);
Console.WriteLine("Image URL: " + image);

Expand All @@ -52,7 +52,8 @@ A cute baby sea otter

var reply = await chatGPT.GetChatMessageContentAsync(chatHistory);
chatHistory.Add(reply);
image = await dallE.GenerateImageAsync(reply.Content!, 256, 256);
images = await dallE.GetImageContentsAsync(reply.Content!, new OpenAITextToImageExecutionSettings { Size = (256, 256) });
image = images[0].Uri!.ToString();
Console.WriteLine("Bot: " + image);
Console.WriteLine("Img description: " + reply);

Expand All @@ -62,7 +63,8 @@ A cute baby sea otter

reply = await chatGPT.GetChatMessageContentAsync(chatHistory);
chatHistory.Add(reply);
image = await dallE.GenerateImageAsync(reply.Content!, 256, 256);
images = await dallE.GetImageContentsAsync(reply.Content!, new OpenAITextToImageExecutionSettings { Size = (256, 256) });
image = images[0].Uri!.ToString();
Console.WriteLine("Bot: " + image);
Console.WriteLine("Img description: " + reply);

Expand Down Expand Up @@ -127,12 +129,12 @@ public async Task OpenAIDallE3Async()
var images = await dallE.GetImageContentsAsync(imageDescription, new OpenAITextToImageExecutionSettings { Size = (1024, 1024) });

Console.WriteLine(imageDescription);
Console.WriteLine("Image URL: " + images[0].Uri!.ToString());
Console.WriteLine("Image URL: " + images[0].Uri!);

/* Output:
A cute baby sea otter
Image URL: https://dalleproduse.blob.core.windows.net/private/images/....
Image URL: https://oaidalleapiprodscus.blob.core.windows.net/private/org-/....
*/

Expand Down

0 comments on commit 34da6a7

Please sign in to comment.