Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions evaluation_function/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
All evaluation logic is in compare_music.py, this file is for the platform interface.
"""


import json
from typing import Any
from lf_toolkit.evaluation import Result, Params

Expand All @@ -20,6 +20,14 @@
DEFAULT_CHORD_ONSET_WINDOW
)

def parse_json_input(data: Any) -> Any:
"""
Convert a JSON string into a Python object.
"""
if isinstance(data, str):
return json.loads(data)
return data


def evaluation_function(
response: Any,
Expand Down Expand Up @@ -50,7 +58,12 @@ def evaluation_function(
"""
if params is None:
params = {}


# The Lambda Feedback app sends response/answer as JSON strings,
# convert them into Python object first
response = parse_json_input(response)
answer = parse_json_input(answer)

result = compare_performance_ED(
response,
answer,
Expand Down
534 changes: 451 additions & 83 deletions notebooks/Alignment_on_nASAPdataset.ipynb

Large diffs are not rendered by default.

Loading