{"id":16098937,"url":"https://github.com/chisandrei/cognitive-service-demo","last_synced_at":"2025-08-13T15:49:11.497Z","repository":{"id":72866251,"uuid":"113030057","full_name":"chisandrei/cognitive-service-demo","owner":"chisandrei","description":"An example app that uses Azure Face API to detect and highlight faces in a gallery of pictures.","archived":false,"fork":false,"pushed_at":"2018-09-06T09:58:45.000Z","size":2561,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T22:43:42.109Z","etag":null,"topics":["face-api","pharo","pharo-graphics"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chisandrei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-04T10:41:35.000Z","updated_at":"2019-05-07T14:58:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"f098835a-1bef-4532-b5d6-d1f2f3c4fc2c","html_url":"https://github.com/chisandrei/cognitive-service-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chisandrei/cognitive-service-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chisandrei%2Fcognitive-service-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chisandrei%2Fcognitive-service-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chisandrei%2Fcognitive-service-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chisandrei%2Fcognitive-service-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chisandrei","download_url":"https://codeload.github.com/chisandrei/cognitive-service-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chisandrei%2Fcognitive-service-demo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270268636,"owners_count":24555643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["face-api","pharo","pharo-graphics"],"created_at":"2024-10-09T18:25:09.457Z","updated_at":"2025-08-13T15:49:11.435Z","avatar_url":"https://github.com/chisandrei.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cognitive Service Demo: Gallery with face detection\n\nThis is an application that displays a galery of pictures and uses the Azures Face API to highlight faces within those pictures. The application is written in [Pharo](pharo.org) and uses [Bloc](https://github.com/pharo-graphics/Bloc/) as a graphical framework.\n\n\u003cimg src=\"docs/images/PicturesGallery.png\"/\u003e\n\n## Loading the code\n\nLoading the complete application, including Bloc can be done with the following snippet:\n```\nMetacello new\n   baseline: 'CognitiveServiceDemo';\n   repository: 'github://chisandrei/cognitive-service-demo/src';\n   load.\n```\n\nLoading just the model, without Bloc and the actual application can be done using the snipet below. You can use this if you just want to follow the tutorial without running the final application.\n```\nMetacello new\n   baseline: 'CognitiveServiceDemo';\n   repository: 'github://chisandrei/cognitive-service-demo/src';\n   load: 'part1'.\n```\n\n## Starting the application\n\nTo start the application you need to configure a data source that will provide the user interface with a list of picture objects. \n\nWe can configure the data source based on a list of URLs pointing to pictures. The class `CSExamplesData` provides an example of pictures from [unsplash.com](https://unsplash.com/). In case you have an API key for the Face API you can configure the data source just with the URL for the pictures. The Face API will then be used to locate faces within the given picture.\n\n```\nCSFaceApiClient defaultKey: Clipboard clipboardText asString.\n\ngalleryDataSource := CSGalleryDataSource new\n\tpicturesProvider: [ \n\t\t| urls |\n\t\turls := CSExamplesData unsplashPicturesCroppedUrls.\n\t\turls withIndexCollect: [ :anUrl :anIndex |\n\t\t\t CSPicture new \n\t\t\t\t url: anUrl ] ].\n\t\t\nCSGalleryMorph openInNewSpaceFor: galleryDataSource.\n```\n\nIf you do not have an API key then the class `CSExamplesData` also provides the JSON data for identifing faces that would normally be returned by the Face API. You can configure the datasource to use this data.\n\n```\ngalleryDataSource := CSGalleryDataSource new\n\tpicturesProvider: [ \n\t\t| urls facesJson |\n\t\turls := CSExamplesData unsplashPicturesCroppedUrls.\n\t\tfacesJson := CSExamplesData unsplashJsonPicturesCropped.\n\t\turls withIndexCollect: [ :anUrl :anIndex |\n\t\t\t CSPicture new \n\t\t\t\turl: anUrl;\n\t\t\t\taddFacesFromJsonData: (facesJson at: anIndex) ] ].\n        \nCSGalleryMorph openInNewSpaceFor: galleryDataSource.\n```\n\nInstead of calling `openInNewSpaceFor:` to open the gallery you can also create a gallery object and open it in a new space manually:\n\n```\ngalleryMorph := CSGalleryMorph new\n\tdataSource: galleryDataSource;\n\tconstraintsDo: [ :c |\n\t\tc horizontal matchParent.\n\t\tc vertical matchParent ].\n\nspace := BlSpace new.\nspace root addChild: galleryMorph.\nspace show.\n```\n\n## Inspector extensions\n\nTo quickly esperiment with the gallery morph, instead of opening it in a new window, you can also inspect it. The inspector has a Live view that shows the gallery:\n\n\u003cimg src=\"docs/images/Playground-GalleryLive.png\"/\u003e\n\nInspecting the data source also show information about the pictures, like the number of faces from each picture:\n\n\u003cimg src=\"docs/images/Playground-DatasourceFaces.png\"/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchisandrei%2Fcognitive-service-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchisandrei%2Fcognitive-service-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchisandrei%2Fcognitive-service-demo/lists"}