def test_send_age_feedback(self): """ send face feedback """ feedback_info = FeedbackInfo(end_user_id='robert_python_test_key', session_id='from_your_browser', event_type='annotation', output_id='oooooooid') m = self.app.models.get('general-v1.3') identities = [ Concept(concept_id='xx', value=True), Concept(concept_id='x2', value=False) ] ages = [Concept(concept_id='1', value=True)] face = Face(identity=FaceIdentity(identities), age_appearance=FaceAgeAppearance(ages)) regions = [ Region(RegionInfo(bbox=BoundingBox(0.3, 0.2, 0.7, 0.8)), face=face) ] ret = m.send_region_feedback( input_id='xyz', url='https://samples.clarifai.com/dog.tiff', regions=regions, feedback_info=feedback_info) self.assertEqual(ret['status']['code'], 10000) # send multiple items identities = [ Concept(concept_id='xx', value=True), Concept(concept_id='x2', value=False), Concept(concept_id='x4', value=True) ] ages = [ Concept(concept_id='1', value=True), Concept(concept_id='2', value=False) ] face = Face(identity=FaceIdentity(identities), age_appearance=FaceAgeAppearance(ages)) regions = [ Region(RegionInfo(bbox=BoundingBox(0.3, 0.2, 0.7, 0.8)), face=face) ] ret = m.send_region_feedback( input_id='xyz', url='https://samples.clarifai.com/dog.tiff', regions=regions, feedback_info=feedback_info) self.assertEqual(ret['status']['code'], 10000)
def test_send_complete_multicultural_feedback(self): """ send face feedback """ feedback_info = FeedbackInfo( end_user_id='robert_python_test_key', session_id='from_your_browser', event_type='annotation', output_id='oooooooid') m = self.app.models.get('general-v1.3') identities = [Concept(concept_id='xx', value=True), Concept(concept_id='x2', value=False)] ages = [Concept(concept_id='1', value=True), Concept(concept_id='2', value=False)] genders = [Concept(concept_id='male', value=True), Concept(concept_id='female', value=False)] cultures = [ Concept(concept_id='american', value=True), Concept(concept_id='asian', value=False) ] face = Face( identity=FaceIdentity(identities), age_appearance=FaceAgeAppearance(ages), gender_appearance=FaceGenderAppearance(genders), multicultural_appearance=FaceMulticulturalAppearance(cultures)) regions = [Region(RegionInfo(bbox=BoundingBox(0.3, 0.2, 0.7, 0.8)), face=face)] ret = m.send_region_feedback( input_id='xyz', url=sample_inputs.DOG_TIFF_IMAGE_URL, regions=regions, feedback_info=feedback_info) self.assertEqual(ret['status']['code'], 10000)