Skip to content

Commit 0fb0d66

Browse files
committed
fix: Pytests spacy
1 parent 2ba0cce commit 0fb0d66

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

label_studio_ml/examples/nemo_asr/test_api.py

+43-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,49 @@ def client():
2727
def test_predict(client):
2828
request = json.loads('{"tasks": [{"id": 102651352, "data": {"audio": "https://htx-pub.s3.amazonaws.com/datasets/audio/f2bjrop1.1.wav"}, "meta": {}, "created_at": "2024-04-08T15:52:07.473205Z", "updated_at": "2024-04-08T15:52:07.473210Z", "is_labeled": false, "overlap": 1, "inner_id": 2, "total_annotations": 0, "cancelled_annotations": 0, "total_predictions": 0, "comment_count": 0, "unresolved_comment_count": 0, "last_comment_updated_at": null, "project": 62075, "updated_by": null, "file_upload": 1430391, "comment_authors": [], "annotations": [], "predictions": []}], "project": "62075.1712591487", "label_config": "<View>\\n <Audio name=\\"audio\\" value=\\"$audio\\" zoom=\\"true\\" hotkey=\\"ctrl+enter\\" />\\n <Header value=\\"Provide Transcription\\" />\\n <TextArea name=\\"transcription\\" toName=\\"audio\\"\\n rows=\\"4\\" editable=\\"true\\" maxSubmissions=\\"1\\" />\\n</View>", "params": {"login": null, "password": null, "context": null}}')
2929

30-
expected_response = json.loads('{"results":[{"model_version":"NemoASR-v0.0.1","result":[{"from_name":"transcription","to_name":"audio","type":"textarea","value":{"text":["ffected to be named in march it may be the most important appointment governor michael dukakis makes during the remainder of his administration and one of the toughest s w b ar as murgr menikovi"]}}],"score":1.0}]}\n')
30+
expected_response = {
31+
"results": [
32+
{
33+
"model_version": "SpacyMLBackend-v0.0.1",
34+
"result": [
35+
{
36+
"from_name": "ner_tags",
37+
"to_name": "text",
38+
"type": "labels",
39+
"value": {
40+
"end": 10,
41+
"labels": ["PERSON"],
42+
"start": 0,
43+
"text": "Katy Perry"
44+
}
45+
},
46+
{
47+
"from_name": "ner_tags",
48+
"to_name": "text",
49+
"type": "labels",
50+
"value": {
51+
"end": 23,
52+
"labels": ["ORG"],
53+
"start": 15,
54+
"text": "Pharrell"
55+
}
56+
},
57+
{
58+
"from_name": "ner_tags",
59+
"to_name": "text",
60+
"type": "labels",
61+
"value": {
62+
"end": 83,
63+
"labels": ["PRODUCT"],
64+
"start": 47,
65+
"text": "Apple Watches http://t.co/k6k3SdwShP"
66+
}
67+
}
68+
],
69+
"score": 0.0
70+
}
71+
]
72+
}
3173

3274
response = client.post('/predict', data=json.dumps(request), content_type='application/json')
3375
assert response.status_code == 200

0 commit comments

Comments
 (0)