Gpt2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
using var client = new HuggingFaceClient(apiKey);

var response = await client.GenerateTextAsync(
    "gpt2",
    new GenerateTextRequest
    {
        Inputs = "Give random 5 words in response",
        Parameters = new GenerateTextRequestParameters
        {
            MaxNewTokens = 250,
        },
        Options = new GenerateTextRequestOptions(),
    });

foreach (var value in response)
{
    Console.WriteLine(value.GeneratedText);
}