All Projects → heartexlabs → pyheartex

heartexlabs / pyheartex

Licence: MIT license
Heartex Python SDK - Connect your own models to Heartex Data Labeling

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pyheartex

Label Studio
Label Studio is a multi-type data labeling and annotation tool with standardized output format
Stars: ✭ 7,264 (+26803.7%)
Mutual labels:  annotations, data-labeling
jupyter-bbox-widget
A Jupyter widget for annotating images with bounding boxes
Stars: ✭ 19 (-29.63%)
Mutual labels:  annotations, data-labeling
TouchPortalPluginSDK
This Project is an SDK to create a Touch Portal Plugin using Java or Kotlin and Gradle
Stars: ✭ 32 (+18.52%)
Mutual labels:  annotations
aioapi
Yet another way to build APIs using AIOHTTP framework
Stars: ✭ 14 (-48.15%)
Mutual labels:  annotations
auto-parcel
A fast annotation processor to make your objects `Parcelable` without writing any of the boilerplate.
Stars: ✭ 80 (+196.3%)
Mutual labels:  annotations
DyAnnotationExtractor
DyAnnotationExtractor is software for extracting annotations (highlighted text and comments) from e-documents like PDF.
Stars: ✭ 34 (+25.93%)
Mutual labels:  annotations
symbok-bundle
Symfony annotations bundle
Stars: ✭ 50 (+85.19%)
Mutual labels:  annotations
GEAN
This toolkit deals with GEnomic sequence and genome structure ANnotation files between inbreeding lines and species.
Stars: ✭ 36 (+33.33%)
Mutual labels:  annotations
Parceler
简单的Bundle数据注入框架
Stars: ✭ 107 (+296.3%)
Mutual labels:  annotations
annotate
Create 3D labelled bounding boxes in RViz
Stars: ✭ 104 (+285.19%)
Mutual labels:  annotations
Easy-Fragment-Argument
This library will help you to pass and receive fragment arguments in easier way
Stars: ✭ 17 (-37.04%)
Mutual labels:  annotations
code-art
🌈 Collect beautiful art text, never bug. 收集好看的艺术代码,佛祖保佑,永无 Bug。找好看的注释,看这里。
Stars: ✭ 38 (+40.74%)
Mutual labels:  annotations
young-examples
java学习和项目中一些典型的应用场景样例代码
Stars: ✭ 21 (-22.22%)
Mutual labels:  annotations
hyperion
Experimental framework for working with IIIF in JavaScript and Typescript.
Stars: ✭ 17 (-37.04%)
Mutual labels:  annotations
goat
Annotate Images (or goats) On The Web™
Stars: ✭ 75 (+177.78%)
Mutual labels:  annotations
twc
TypeScript based, boilerplate-less, Polymer toolbox friendly Polymer Modules
Stars: ✭ 33 (+22.22%)
Mutual labels:  annotations
obsidian-hypothesis-plugin
An Obsidian.md plugin that syncs highlights from Hypothesis.
Stars: ✭ 164 (+507.41%)
Mutual labels:  annotations
clothing-detection-ecommerce-dataset
Clothing detection dataset
Stars: ✭ 43 (+59.26%)
Mutual labels:  annotations
GdprBundle
A symfony3 bundle to assist with defining data in accordance with GDPR, and for encrypting and reporting.
Stars: ✭ 61 (+125.93%)
Mutual labels:  annotations
PrimeAdapter
PrimeAdapter makes working with RecyclerView easier.
Stars: ✭ 54 (+100%)
Mutual labels:  annotations

DEPRECATED and NOT COMPATIBLE WITH LABEL STUDIO: NO LONGER SUPPORTED.

Please check https://github.com/heartexlabs/label-studio-ml-backend instead

Python interface for running ML backend server and using it for active learning & prelabeling & prediction within Heartex platform

Installation

First make sure you have Redis server running (otherwise you can use only prediction, not active learning).

Install Heartex SDK:

git clone https://github.com/heartexlabs/pyheartex.git
cd pyheartex/
pip install -r requirements.txt
pip install -e .

Last thing you should do is to start RQ workers in the background:

rq worker default

Using Docker

Here is an example how to start serving image classifier:

cd examples/docker
docker-compose up

All you need to replace with your own model is to change loading, inference and training scripts from this file.

Quick start

Quick start guide provides the usage of the following popular machine learning frameworks within Heartex platform:

Scikit-learn

Let's serve scikit-learn model for text classification.

You can simply launch

python examples/quickstart.py

This script looks like

from htx.adapters.sklearn import serve

from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline


if __name__ == "__main__":

    # Creating sklearn-compatible model
    my_model = make_pipeline(TfidfVectorizer(), LogisticRegression())

    # Start serving this model
    serve(my_model)

It starts serving at http://localhost:16118 listening for Heartex event. To connect your model, go to Heartex -> Settings -> Machine learning page and choose "Add custom model".

Or you can use Heartex API to activate your model:

curl -X POST -H 'Content-Type: application/json' \
-H 'Authorization: Token <PUT-YOUR-TOKEN-HERE>' \
-d '[{"url": "$HOST:$PORT", "name": "my_model", "title": "My model", "description": "My new model deployed on Heartex"}]' \
http://go.heartex.net/api/projects/{project-id}/backends/

where $HOST:$PORT is your server URL that should be accessible from the outside.

FastAI

You can integrate FastAI models similarly to scikit-learn. Check this example to learn how to plug in updateable image classifier.

Advanced usage

When you want to go beyond using sklearn compatible API, you can build your own model, by making manually input/output interface conversion. You have to subclass Heartex models as follows:

from htx.base_model import BaseModel

# This class exposes methods needed to handle model in the runtime (loading into memory, running predictions)
class MyModel(BaseModel):

    def get_input(self, task):
        """Extract input from serialized task"""
        pass
    
    def get_output(self, task):
        """Extract output from serialized task"""
        pass
        
    def load(self, train_output):
        """Loads model into memory. `train_output` dict is actually the output the `train` method (see below)"""
        pass
        
    def predict(self, tasks):
        """Get list of tasks, already processed by `get_input` method, and returns completions in Heartex format"""
        pass
        
# This method handles model retraining
def train(input_tasks, output_model_dir, **kwargs):
    """
    :param input_tasks: list of tasks already processed by `get_input`
    :param output_model_dir: output directory where you can optionally store model resources
    :param kwargs: any additional kwargs taken from `train_kwargs`
    :return: `train_output` dict for consequent model loading
    """
    pass
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].