from typing import Counter


def uniques(generator):
    """
    Count the number of unique items in a stream.

    Return a dictionary mapping items to counts."""
    counter = Counter()
    for value in generator:
        counter[value] += 1
    return dict(counter)