File size: 350 Bytes
333cd19
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
# Function to check if the uploaded file has the expected columns
def check_columns(df):
    if set(df.columns) == set(["text", "label"]):
        return True
    else:
        return False


# Function to calculate the number of instances of each label class
def count_labels(df):
    counts = df["label"].value_counts()
    return counts.to_dict()