{"id":47311140,"url":"https://github.com/inception-project/inception-external-recommender-v2","last_synced_at":"2026-03-17T11:29:45.553Z","repository":{"id":43080600,"uuid":"367495293","full_name":"inception-project/inception-external-recommender-v2","owner":"inception-project","description":"Machine learning model server that can predict AND train","archived":false,"fork":false,"pushed_at":"2022-05-23T21:12:45.000Z","size":810,"stargazers_count":5,"open_issues_count":15,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-26T16:05:06.970Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/inception-project.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":"2021-05-14T22:46:27.000Z","updated_at":"2023-01-18T15:12:29.000Z","dependencies_parsed_at":"2022-09-26T20:52:43.035Z","dependency_job_id":null,"html_url":"https://github.com/inception-project/inception-external-recommender-v2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/inception-project/inception-external-recommender-v2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inception-project%2Finception-external-recommender-v2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inception-project%2Finception-external-recommender-v2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inception-project%2Finception-external-recommender-v2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inception-project%2Finception-external-recommender-v2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inception-project","download_url":"https://codeload.github.com/inception-project/inception-external-recommender-v2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inception-project%2Finception-external-recommender-v2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30622675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T11:26:08.186Z","status":"ssl_error","status_checked_at":"2026-03-17T11:24:37.311Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-03-17T11:29:42.804Z","updated_at":"2026-03-17T11:29:45.546Z","avatar_url":"https://github.com/inception-project.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# galahad\n\n\u003ca href='https://inception-galahad.readthedocs.io/en/latest'\u003e\n    \u003cimg src='https://readthedocs.org/projects/inception-galahad/badge/?version=latest' alt='Documentation Status' /\u003e\n\u003c/a\u003e\n\n\nMachine learning model server for NLP that can predict AND train. It can be e.g. used for interactive machine\nlearning setups or as an external recommender with [INCEpTION](https://inception-project.github.io/).\nIt provides a REST-like interface and hence is integrable with a wide range of applications and use cases.\n\n## Installation\n\nYou can install the newest version via\n\n    pip install galahad\n\n## Usage\n\n`galahad` is a server-based application that uses [FastApi](https://fastapi.tiangolo.com/)\nin the background. To get started, create a Python script like the one below.\n\n```python\nimport logging\n\nimport uvicorn\n\nfrom galahad.server import GalahadServer\nfrom galahad.server.contrib.ner.spacy_ner import SpacyNerTagger\nfrom galahad.server.contrib.pos.spacy_pos import SpacyPosTagger\nfrom galahad.server.contrib.sentence_classification.sklearn_sentence_classifier import SklearnSentenceClassifier\n\nserver = GalahadServer(\"my_data_folder\")\nserver.add_classifier(\"SpacyPOS\", SpacyPosTagger(\"en_core_web_sm\"))\nserver.add_classifier(\"SpacyNER\", SpacyNerTagger(\"en_core_web_sm\"))\nserver.add_classifier(\"Sent\", SklearnSentenceClassifier())\n\n\nif __name__ == \"__main__\":\n    logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.DEBUG)\n\n    uvicorn.run(server, host=\"127.0.0.1\", port=8000)\n```\n\nThis starts `galahad` so that you can use it e.g. together with the `galahad` client\nor as a recommender in [INCEpTION](https://inception-project.github.io/).\n\nAlternatively, you can run it on the command line via `uvicorn main:server`, where `main` is the name of your script \n(in this case, *main.py*) and `server` the name of your `GalahadServer` variable.\n\n## API documentation\n\nWhen running a Galahad instance, you can view the REST API documentation on http://localhost:8000/redoc .\n\n## Examples\n\n`galahad` can be used with a wide range of different clients. A few examples are described in the following:\n\n### INCEpTION\n\n[INCEpTION](https://inception-project.github.io/) is a semantic annotation platform offering intelligent \nassistance and knowledge management. It is widely used in the NLP community for annotating text.\n`galahad` can be used to provide annotation suggestions to improve annotation speed and quality.\nThese can either be static or dynamic. For the latter, `galahad` models are trained and updated during annotation\nto provide better suggestions the more data is annotated.\n\nIn order to connect INCEpTION and `galahad`, you first need to write a server Python script like above. add models to\nyour server and then run it. In INCEpTION, in your project, go to the recommender settings.\nAdd a external recommender V2 to INCEpTION, check the server connection and then select a classifer\nfrom the list. You are now ready to annotate!\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/inception-project/inception-external-recommender-v2/main/img/galahad_inception.gif\" /\u003e\n\u003c/p\u003e\n\nAs an example, here we annotate named entities and use a pre-trained [Spacy](https://spacy.io/) model.\nGray are recommendations and red are real annotations. Annotators can accept, reject or ignore suggestions\nmade by Galahad.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/inception-project/inception-external-recommender-v2/main/img/inception_galahad_ner.png\" /\u003e\n\u003c/p\u003e\n\n### Gradio\n\nAfter starting a Galahad instance, you can visualize the predictions of pretrained models via\n[Gradio](https://gradio.app/). For that, just run \n\n    python examples/gradio_demo.py TASK_NAME\n\nWe currently support part-of-speech tagging (`pos`) and named entity recognition (`ner`) as tasks.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/inception-project/inception-external-recommender-v2/main/img/gradio_ner.png\" alt=\"Gradio named entity recognition demo\"/\u003e\n\u003c/p\u003e\n\n### Python client\n\nGalahad comes with a Python client that you can use to programmatically access the API without worrying about the \nunderlying protocol. Please refer to the API documentation of Galahad that describes how to use it.\n\n## Architecture\n\nGalahad works on the basis of *datasets*, *documents*, *classifiers*, *models*, **annotations**.\n\n- **Document**: A document contains the text and annotations. \n- **Dataset**: a dataset groups annotated documents together, representing e.g. an annotated corpus.\n- **Classifier**: A classifier is a machine learning algorithm that can be used to make predictions and can be optionally\n  be trained. The result of training is called the *model*. There can be multiple models for each classifier, e.g. one\n  per user. \n- **Annotations**: Annotations consist of a type and features. Annotations can either represent spans by having a begin\n  and end feature that points into the text or be standalone.\n\n### Document representation\n\nDocuments are represented as JSON objects. They have a text, a version and annotations. Annotations are grouped by \ntheir type. An example document looks like the following:\n\n```json\n{\n    \"text\": \"Joe waited for the train . The train was late .\",\n    \"version\": 23,\n    \"annotations\": {\n        \"t.token\": [\n            {\"begin\": 0, \"end\": 3},\n            {\"begin\": 4, \"end\": 10},\n            {\"begin\": 11, \"end\": 14},\n            {\"begin\": 15, \"end\": 18},\n            {\"begin\": 19, \"end\": 24},\n            {\"begin\": 25, \"end\": 26},\n            {\"begin\": 27, \"end\": 30},\n            {\"begin\": 31, \"end\": 36},\n            {\"begin\": 37, \"end\": 40},\n            {\"begin\": 41, \"end\": 45},\n            {\"begin\": 46, \"end\": 47}\n        ],\n        \"t.sentence\": [\n            {\"begin\": 0, \"end\": 26},\n            {\"begin\": 27, \"end\": 47}\n        ],\n        \"t.named_entity\": [\n            {\"begin\": 0, \"end\": 3, \"features\": {\"f.value\": \"PER\"}}\n        ]\n    }\n}\n```\n\n### Disk layout\n\nGalahad stores datasets, documents and models on disk. The layout looks like the following:\n\n    data\n    ├───datasets\n    │   └───dataset1\n    │       └───document1\n    │       └───document2\n    │   └───dataset2\n    ├───locks\n    ├───models\n    │   └───classifier1\n    │   └───classifier2\n\nWe also plan to add additional store alternatives to Galahad, for instance SQLite.\n\n### Classifier training\n\nClassifier training is done by creating a new process that then takes over the training. This is needed because of the\nGIL in Python. If we did not do this, then the main thread would be blocked and the web app could not respond to new requests.\nAlso, only one model could be trained at the time. \n\nWhen the request to train a classifier arrives, it is first checked whether training is not already\nrunning. Training the same classifier twice at the same time is prevented by using file locks.\n\n## Development\n\nThe required dependencies are managed by **pip**. A virtual environment\ncontaining all needed packages for development and production can be\ncreated and activated by\n\n    python3 -m venv venv\n    source venv/bin/activate\n    pip install -e \".[all]\"\n    make get_test_dependencies\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finception-project%2Finception-external-recommender-v2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finception-project%2Finception-external-recommender-v2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finception-project%2Finception-external-recommender-v2/lists"}