few-shot-demo / utils.py
spdin
initial commit
333cd19
raw
history blame
350 Bytes
# 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()