# -- Code Cell --
import zipfile

with zipfile.ZipFile("test_data.zip", 'r') as zip_ref:
    zip_ref.extractall(path="")

with zipfile.ZipFile("train_data.zip", 'r') as zip_ref:
    zip_ref.extractall(path="")

# -- Code Cell --
# !unzip train_data.zip
# !unzip test_data.zip

# -- Code Cell --
from PIL import Image

# READING THE BLANK SCORE IMAGE AND THE NOTES IMAGE

blank = Image.open("train_data/empty_piano_score.png")
notes = Image.open("train_data/all_piano_notes_duration.png")

# -- Code Cell --
blank

# -- Code Cell --
notes

# -- Code Cell --
# IN THE FOLDER test_data ARE ALL THE IMAGES

random_image = Image.open("test_data/0.png")

# -- Code Cell --
random_image

# -- Code Cell --
import glob
import os
from tqdm import tqdm
import pandas as pd

test_paths = sorted(glob.glob("test_data/*.png"))

results = []

for path in tqdm(test_paths):
  dp_id = int(os.path.basename(path).split('.')[0])
  img = Image.open(path)

  # HERE YOU CAN ADD YOUR OWN CODE FOR CALCULATING THE ANSWER FOR THE 3 SUBTASKS FOR IMAGE img


  # --------------- SUBTASK 1 ---------------
  # WRITE YOUR OWN CODE HERE
  ans_subtask1  = 0

  # --------------- SUBTASK 2 ---------------
  # WRITE YOUR OWN CODE HERE
  ans_subtask2  = 0

  # --------------- SUBTASK 3 ---------------
  # WRITE YOUR OWN CODE HERE
  ans_subtask3  = ""


  results.extend([[1, dp_id, ans_subtask1], [2, dp_id, ans_subtask2], [3, dp_id, ans_subtask3]])

pd.DataFrame(results, columns=["subtaskID", "datapointID", "answer"]).to_csv("submission.csv", index=False)