From 040e2f8237a30a02136b4c38d4f55b89b541cbd9 Mon Sep 17 00:00:00 2001 From: Edouard Leurent Date: Mon, 9 Sep 2024 13:33:31 +0000 Subject: [PATCH] Add a draft identification test --- backend/nature_go/identification/tests.py | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 backend/nature_go/identification/tests.py diff --git a/backend/nature_go/identification/tests.py b/backend/nature_go/identification/tests.py new file mode 100644 index 0000000..efc89e6 --- /dev/null +++ b/backend/nature_go/identification/tests.py @@ -0,0 +1,28 @@ + +from django.test import TestCase +from identification import gemini +from observation.models import Species + + +class GeminiTestCase(TestCase): + def setUp(self): + Species.objects.create( + type=Species.BIRD_TYPE, + scientificNameWithoutAuthor='Alcedo atthis', + commonNames=['Common kingfisher'], + genus='Alcedo', + family='Alcedinidae', + ) + + def test_gemini_identification(self): + image_path = './identification/test_bird_image.jpg' # TODO: download from link + location = {} + + response = gemini.gemini_identify_few_shot( + image_path=image_path, + location=location, + few_shots=gemini.BIRD_ID_FEW_SHOTS, + ) + print(response) + self.assertIsNotNone(response) +