{"id":13686722,"url":"https://github.com/xaynetwork/xayn_ai","last_synced_at":"2025-05-01T09:32:29.168Z","repository":{"id":40431266,"uuid":"336235305","full_name":"xaynetwork/xayn_ai","owner":"xaynetwork","description":"Xayn AI","archived":true,"fork":false,"pushed_at":"2022-05-09T08:05:01.000Z","size":1810,"stargazers_count":17,"open_issues_count":1,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-05-30T01:27:46.584Z","etag":null,"topics":["artificial-intelligence","dart","rust","wasm"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xaynetwork.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-05T10:14:48.000Z","updated_at":"2023-03-05T03:28:21.000Z","dependencies_parsed_at":"2022-08-09T20:11:06.696Z","dependency_job_id":null,"html_url":"https://github.com/xaynetwork/xayn_ai","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaynetwork%2Fxayn_ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaynetwork%2Fxayn_ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaynetwork%2Fxayn_ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaynetwork%2Fxayn_ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xaynetwork","download_url":"https://codeload.github.com/xaynetwork/xayn_ai/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251830468,"owners_count":21650803,"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":["artificial-intelligence","dart","rust","wasm"],"created_at":"2024-08-02T15:00:38.681Z","updated_at":"2025-05-01T09:32:28.710Z","avatar_url":"https://github.com/xaynetwork.png","language":"Rust","funding_links":[],"categories":["dart"],"sub_categories":[],"readme":"`xain_ai` is no longer actively maintained. Parts of the code have been copied to\n[xayn_discovery_engine](https://github.com/xaynetwork/xayn_discovery_engine) and will be further developed there.\n\n---\n\n# Xayn-AI\n\n## Models\n\nTo download the models use the `download_data.sh` script.\n\n## Tools\n\nIn order to generate the code that contains the metadata of the assets,\nyou will need to install [`gomplate`](https://github.com/hairyhenderson/gomplate).\n\n## Build\n\nTo build the library you just need to run `cargo build` in the root of the project.\n\nTo generate the dart ffi you need to run `flutter pub get` and `flutter pub run ffigen` in\nthe directory `bindings/dart`.\n\nTo update the non-ffi auto generated dart code after changes to dart code you need\nto run `flutter pub run build_runner build`.\n\nThe project provides a `Makefile.toml` that can be run with `cargo make`.\nYou can install cargo make with:\n\n```\ncargo install --version 0.35.0 cargo-make\n```\n\nAll of the above can be automatically done by `cargo make build`.\n\nTo build libraries for mobile targets you can use:\n\n```\ncargo make build-mobile\n```\n\nOn Linux this will only build Android libraries, while on Mac it will build\nfor both Android and iOS.\n\nTo build the library for web you can use:\n\n```\ncargo make build-web\n```\n\nor\n\n```\nDISABLE_WASM_THREADS=1 cargo make build-web\n```\n\nto build a version which doesn't require the browser to\nsupport `SharedArrayBuffer` and `Atomics`.\n\n### Android\n\nTo build for Android the following targets are needed:\n\n```\nrustup target add \\\n  aarch64-linux-android \\\n  armv7-linux-androideabi \\\n  x86_64-linux-android \\\n  i686-linux-android\n```\n\nAlso `cargo-ndk` is needed:\n\n```\ncargo install --version 2.4.1 cargo-ndk\n```\n\nYou also need to install android ndk and might need to set the `ANDROID_NDK_HOME` variable.\nIf you install the android ndk through AndroidStudio you would need to set `ANDROID_NDK_HOME`\nto something like `~/Android/Sdk/ndk/\u003cndk-version\u003e` which for example could be\n`/home/user/Android/Sdk/ndk/22.1.7171670/`.\n\n### iOS\n\nTo build for iOS the following targets are needed:\n\n```\nrustup target add \\\n  aarch64-apple-ios \\\n  x86_64-apple-ios\n```\n\n### WASM\n\n#### Prerequisites\n\n- wasm-pack\n\n```\ncargo install --version 0.10.1 wasm-pack\n```\n\n- `rustup target add wasm32-unknown-unknown`\n- [nodejs](https://nodejs.org/en/) (only if you want to run the tests on nodejs)\n- [yarn](https://yarnpkg.com/)\n\nAll `wasm-pack` commands below are to be run in the directory `xayn-ai-ffi-wasm/`.\n\n#### Building the WASM module\n\n```\nwasm-pack build\n```\n\n#### Running the WASM test\n\n**Browser**\n\n```\nwasm-pack test --firefox --chrome --safari --headless\n```\n\nNote:\n\nIn `Safari` you first need to [enable the WebDriver support](https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari)\nvia `safaridriver --enable`, before you can run tests.\n\n**nodejs**\n\n```\nwasm-pack test --node -- --no-default-features --features=node\n```\n\n### Flutter example\n\n#### Running on a mobile device/emulator\n\n```shell\ncargo make build-mobile\ncd bindings/dart/example\nflutter run\n```\n\n#### Running in Chrome\n\n```shell\ncargo make build-web\ncargo make serve-web\n# Then open http://localhost:8000/ in a browser.\n```\n\n`flutter run` can not be used as it doesn't set the\nright headers, and even with the right headers it\ndoesn't provide the right files in the right way.\n\n(At least for now `flutter run` can still be used\nwith `DISABLE_WASM_THREADS=1`, this is not guaranteed\nin the future but can be useful as `flutter run` provides\nhot reloading and better debug-ability.)\n\n**Hint:** There had been some cases where for some reason\n`genesis.js` wasn't updated when switching from `DISABLE_WASM_THREADS=0`\nto `DISABLE_WASM_THREADS=1` it's not clear what causes it as\nit's not reproducible but it was observed by different dev.\nIf that happens run `cargo make clean-non-rust`.\n\n#### Running with a branch of the release repository\n\n**bindings/dart/example/pubspec.yaml**\n\n```diff\n  xayn_ai_ffi_dart:\n-   path: '../'\n+   git:\n+       url: git@github.com:xaynetwork/xayn_ai_release.git\n+       ref: \u003cbranch\u003e\n```\n\n**bindings/dart/example/lib/data_provider/web.dart**\n\n```diff\n- const _baseAssetUrl = 'assets';\n+ const _baseAssetUrl = 'https://ai-assets.xaynet.dev';\n```\n\nThen use `cargo make build-web` and `cargo make serve-web` like above.\n\nIf flutter analyze fails there is a good chance that the local version\nand the used branch in the release repo are not compatible.\n\n## License\n\nThis repository contains code from other software in the following\ndirectories, licensed under their own particular licenses:\n\n * `rubert-tokenizer/*`: Apache2 ([LICENSE](rubert-tokenizer/LICENSE))\n\nXayn-ai and its components, unless otherwise stated, are licensed under\n * AGPL-3.0 ([LICENSE](LICENSE)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaynetwork%2Fxayn_ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaynetwork%2Fxayn_ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaynetwork%2Fxayn_ai/lists"}