{"id":18473433,"url":"https://github.com/0xopenbytes/camel","last_synced_at":"2025-04-16T02:53:23.333Z","repository":{"id":153186909,"uuid":"628433209","full_name":"0xOpenBytes/Camel","owner":"0xOpenBytes","description":"🐫 Camel simplifies CoreML integration, so you don't have to hump it alone","archived":false,"fork":false,"pushed_at":"2023-04-15T23:51:40.000Z","size":13,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T04:26:01.259Z","etag":null,"topics":["coreml","ios","machine-learning","macos","swift","tvos","watchos"],"latest_commit_sha":null,"homepage":"https://0xopenbytes.github.io/Camel/","language":"Swift","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/0xOpenBytes.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":"2023-04-15T23:36:56.000Z","updated_at":"2025-02-04T17:33:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"768044f3-6717-4ac2-860c-173a0c7596f9","html_url":"https://github.com/0xOpenBytes/Camel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xOpenBytes%2FCamel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xOpenBytes%2FCamel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xOpenBytes%2FCamel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xOpenBytes%2FCamel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xOpenBytes","download_url":"https://codeload.github.com/0xOpenBytes/Camel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249187485,"owners_count":21226912,"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":["coreml","ios","machine-learning","macos","swift","tvos","watchos"],"created_at":"2024-11-06T10:24:56.477Z","updated_at":"2025-04-16T02:53:23.326Z","avatar_url":"https://github.com/0xOpenBytes.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Camel\n\n*Camel simplifies CoreML integration, so you don't have to hump it alone.*\n\nCamel is a Swift library that simplifies the integration of CoreML models into your application. It provides a caching mechanism for compiled CoreML models and an easy-to-use interface for making predictions using those models.\n\n## Usage\n\n### Initializing Camel\n\nYou can create a new Camel instance by specifying a dictionary of CoreML models with associated keys:\n\n```swift\nlet modelDictionary: [String: URL] = [\n    \"model1\": Bundle.main.url(forResource: \"Model1\", withExtension: \"mlmodel\")!,\n    \"model2\": Bundle.main.url(forResource: \"Model2\", withExtension: \"mlmodel\")!,\n]\n\nlet camel = try Camel(models: modelDictionary)\n```\n\nCamel can use any Hashable type for the Key.\n\n```swift\nenum ModelKey: String {\n    case model1, model2, model3, model4\n}\n\nlet modelDictionary: [ModelKey: URL] = [\n    .model1: Bundle.main.url(forResource: \"Model1\", withExtension: \"mlmodel\")!,\n    .model2: Bundle.main.url(forResource: \"Model2\", withExtension: \"mlmodel\")!,\n    .model3: URL(string: \"https://example.com/Model3.mlmodel\")!\n]\n\nlet camel = try Camel(models: modelDictionary)\n\n// Add a new model URL\ntry camel.add(modelURL: URL(string: \"https://example.com/Model4.mlmodel\")!, forKey: .model4)\n\n// Predict using one of the models\nlet input = CamelInput(values: [\"input1\": 0.5, \"input2\": 0.8])\nlet output: CamelOutput = try camel.prediction(using: .model1, input: input)\n```\n\n### Making Predictions\n\nOnce you have initialized Camel, you can use it to make predictions on your CoreML models. To make a single prediction, you can use the prediction method:\n\n```swift\nlet input = CamelInput(/* ... */)\n\ndo {\n    let output: CamelOutput = try camel.prediction(using: \"model1\", input: input)\n    // Use the output of the prediction\n} catch {\n    // Handle the error\n}\n```\n\nTo make multiple predictions at once, you can use the predictions method:\n\n```swift\nlet inputs: [CamelInput] = [/* ... */]\n\ndo {\n    let outputs: [CamelOutput] = try camel.predictions(using: \"model1\", inputs: inputs)\n    // Use the outputs of the predictions\n} catch {\n    // Handle the error\n}\n```\n\n### Caching Models\n\nCamel automatically caches the compiled versions of your CoreML models to improve performance. If a compiled model already exists in the cache, Camel will use that model instead of compiling the original model again. You can manually add a model to the cache using the add method:\n\n```swift\nlet modelURL = Bundle.main.url(forResource: \"Model1\", withExtension: \"mlmodelc\")!\n\ndo {\n    try camel.add(modelURL: modelURL, forKey: \"model1\")\n} catch {\n    // Handle the error\n}\n```\n\n## Additional Resources\n\n### Apple [CoreML](https://developer.apple.com/documentation/coreml) Models\n\nApple provides a collection of pre-trained CoreML models that can be used for a variety of tasks. You can find these models at [developer.apple.com/machine-learning/models/](https://developer.apple.com/machine-learning/models/). These models cover a wide range of use cases, including image recognition, natural language processing, and more. \n\n***\n\n- Limitations: Camel is designed to work specifically with CoreML models, so it may not be suitable for other machine learning frameworks. Additionally, it may not work with very large models that exceed the available memory on the device.\n\n- Requirements: Camel requires a device running iOS 14 or later, macOS 11 or later, watchOS 7 or later, or tvOS 14 or later.\n\n- License: Camel is released under the MIT license, which is a permissive open-source license that allows for free use, modification, and distribution of the software.\n\n- Contributions: Contributions to Camel are welcome and encouraged! If you find a bug, or have an idea for a new feature, please open an issue on GitHub or submit a pull request with your changes. Be sure to follow the code of conduct and contribution guidelines outlined in the repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xopenbytes%2Fcamel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xopenbytes%2Fcamel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xopenbytes%2Fcamel/lists"}