{"id":22018327,"url":"https://github.com/testdotai/classifier-client-ruby","last_synced_at":"2026-05-16T08:12:03.705Z","repository":{"id":59157543,"uuid":"228947145","full_name":"testdotai/classifier-client-ruby","owner":"testdotai","description":"Ruby client for the test.ai classifier server","archived":false,"fork":false,"pushed_at":"2019-12-20T17:50:02.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-26T13:01:09.799Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/testdotai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-19T00:57:12.000Z","updated_at":"2019-12-20T17:50:04.000Z","dependencies_parsed_at":"2022-09-13T18:13:26.426Z","dependency_job_id":null,"html_url":"https://github.com/testdotai/classifier-client-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testdotai%2Fclassifier-client-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testdotai%2Fclassifier-client-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testdotai%2Fclassifier-client-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testdotai%2Fclassifier-client-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/testdotai","download_url":"https://codeload.github.com/testdotai/classifier-client-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245081759,"owners_count":20557837,"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","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":[],"created_at":"2024-11-30T05:11:48.332Z","updated_at":"2026-05-16T08:11:58.684Z","avatar_url":"https://github.com/testdotai.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Test.ai Classifier - Ruby Client\n\nThe code in this directory defines a client library for use with the [gRPC-based Test.ai classifier server](https://github.com/testdotai/appium-classifier-plugin).\n\n## Installation \u0026 Setup\n\n```\ngem install testai_classifier\n```\n\n## Usage\n\nThis package exposes a `ClassifierClient` class, which you can instantiate with the host and port the classification server is running on:\n\n```rb\nrequire 'testai_classifier'\n\n# ...\n\nclient = ClassifierClient.new(host, port)\n```\n\nYou can use the client to attempt to match images to a semantic label:\n\n```rb\n# assume cart_img and menu_img are byte strings as delivered by\n# File.read(filename).b\n\n# define a mapping between ids and image data\ndata = {cart: cart_img, menu: menu_img}\n\n# define which label we are looking to match\nlabel = 'cart'\n\n# attempt to match the images with the label\n# confidence is from 0.0 to 1.0 -- any matches with lower than the specified\n# confidence are not returned.\n# allow_weaker_matches specifies whether to return matches that are above\n# the confidence threshold but whose most confident match was a *different*\n# label\nres = client.classify_images(label, data, confidence=0.0, allow_weaker_matches=True)\n\n# res looks like:\n# {cart: {label: 'cart', confidence: 0.9, confidence_for_hint: 0.9},\n#  menu: {label: 'menu', confidence: 0.9, confidence_for_hint: 0.2}}\n```\n\nYou can also use it in conjunction with a Selenium Python client driver object, to find elements in a web page based on the label:\n\n```rb\n@driver.navigate.to \"https://test.ai\"\nels = @client.find_elements_matching_label(@driver, 'twitter')\nels[0].click\n_(@driver.current_url).must_equal 'https://twitter.com/testdotai'\n```\n\n## Development\n\n* `make install` - install deps (requires Bundler)\n* `make protogen` - generate python client helpers from .proto file (if this is done, the require for classifier_services_pb.rb must be updated to become relative).\n* `make clean` - reset generated files\n* `make gem` - build a gem from the project\n* `make test` - run test suite (also `make unit-test` and `make se-test`)\n* `make publish` - publish to rubygems\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestdotai%2Fclassifier-client-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftestdotai%2Fclassifier-client-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestdotai%2Fclassifier-client-ruby/lists"}