Skip to content

Search Datasets

Search for datasets on the HuggingFace Hub using quicksearch and list results.

This example assumes using HuggingFace; is in scope and apiKey contains your HuggingFace API key.

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

var response = await client.RepoSearch.CreateQuicksearchAsync(
    request: new Request57
    {
        Q = "sentiment analysis",
        Limit = 5,
        Exclude = [],
    });

Console.WriteLine($"Models: {response.ModelsCount}, Datasets: {response.DatasetsCount}, Spaces: {response.SpacesCount}");

foreach (var dataset in response.Datasets)
{
    Console.WriteLine($"  Dataset: {dataset.Id}");
}

foreach (var space in response.Spaces)
{
    Console.WriteLine($"  Space: {space.Id}");
}