Skip to content

Commit

Permalink
feat: Minimal Hugging Face Image Classification Pipeline (#852)
Browse files Browse the repository at this point in the history
* Minimal Hugging Face Pipeline

Signed-off-by: Julien Jerphanion <[email protected]>

* Update submodule

Signed-off-by: Julien Jerphanion <[email protected]>

* feat: Add Image Classification app to the gallery

Signed-off-by: Julien Jerphanion <[email protected]>

* Update submodule after the merge of flojoy-ai/nodes#253

Signed-off-by: Julien Jerphanion <[email protected]>

* feat: Register the App as imageClassifcation.json

Co-authored-by: JeffDotPng <[email protected]>

Signed-off-by: Julien Jerphanion <[email protected]>

---------

Signed-off-by: Julien Jerphanion <[email protected]>
  • Loading branch information
jjerphan authored Sep 1, 2023
1 parent 0a8fbf1 commit bc112fa
Show file tree
Hide file tree
Showing 4 changed files with 270 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PYTHON/nodes
Submodule nodes updated 43 files
+75 −0 AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/HUGGING_FACE_PIPELINE.py
+89 −0 AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/HUGGING_FACE_PIPELINE_test_.py
+257 −0 AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/app.json
+ AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/assets/ada_lovelace.png
+3 −0 AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/example.md
+ AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/output.jpeg
+5 −0 AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/PROPHET_PREDICT_test_.py
+8 −0 EXTRACTORS/FILE/READ_S3/READ_S3_test_.py
+12 −0 GENERATORS/SAMPLE_DATASETS/TEXT_DATASET/TEXT_DATASET_test_.py
+44 −0 INSTRUMENTS/MOCK/MOCK_WEINSCHEL8320/MOCK_WEINSCHEL8320.py
+16 −0 INSTRUMENTS/MOCK/MOCK_WEINSCHEL8320/MOCK_WEINSCHEL8320_test_.py
+25 −0 INSTRUMENTS/MOCK/MOCK_WEINSCHEL8320/Weinschel_8320.yaml
+214 −0 INSTRUMENTS/MOCK/MOCK_WEINSCHEL8320/app.json
+21 −0 INSTRUMENTS/QCODES/CLOSE_ALL/CLOSE_ALL.py
+167 −65 TRANSFORMERS/ARITHMETIC/ABS/app.json
+298 −154 TRANSFORMERS/ARITHMETIC/ADD/app.json
+226 −192 TRANSFORMERS/ARITHMETIC/DIVIDE/app.json
+282 −159 TRANSFORMERS/ARITHMETIC/MULTIPLY/app.json
+303 −158 TRANSFORMERS/ARITHMETIC/SUBTRACT/app.json
+1 −1 TRANSFORMERS/ARITHMETIC/SUBTRACT/example.md
+178 −73 TRANSFORMERS/CALCULUS/DIFFERENTIATE/app.json
+1 −1 TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/DOUBLE_DEFINITE_INTEGRAL_test_.py
+279 −152 TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/app.json
+255 −166 TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/app.json
+178 −73 TRANSFORMERS/CALCULUS/INTEGRATE/app.json
+238 −135 TRANSFORMERS/MATRIX_MANIPULATION/INVERT/app.json
+266 −163 TRANSFORMERS/MATRIX_MANIPULATION/MATMUL/app.json
+166 −204 TRANSFORMERS/TYPE_CASTING/DF_2_NP/app.json
+0 −310 TRANSFORMERS/TYPE_CASTING/DF_2_NP/app.txt
+2 −2 TRANSFORMERS/TYPE_CASTING/DF_2_NP/example.md
+521 −0 TRANSFORMERS/TYPE_CASTING/DF_2_ORDERED_TRIPLE/app.json
+315 −0 TRANSFORMERS/TYPE_CASTING/MAT_2_DF/app.json
+0 −229 TRANSFORMERS/TYPE_CASTING/MAT_2_DF/app.txt
+2 −2 TRANSFORMERS/TYPE_CASTING/MAT_2_DF/example.md
+461 −0 TRANSFORMERS/TYPE_CASTING/NP_2_DF/app.json
+0 −373 TRANSFORMERS/TYPE_CASTING/NP_2_DF/app.txt
+2 −2 TRANSFORMERS/TYPE_CASTING/NP_2_DF/example.md
+394 −0 TRANSFORMERS/TYPE_CASTING/ORDERED_TRIPLE_2_SURFACE/app.json
+0 −247 TRANSFORMERS/TYPE_CASTING/ORDERED_TRIPLE_2_SURFACE/app.txt
+2 −2 TRANSFORMERS/TYPE_CASTING/ORDERED_TRIPLE_2_SURFACE/example.md
+8 −0 VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/PROPHET_COMPONENTS_test_.py
+8 −0 VISUALIZERS/PLOTLY/PROPHET_PLOT/PROPHET_PLOT_test_.py
+5 −5 requirements.txt
Binary file added public/assets/appGallery/imageClassification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
257 changes: 257 additions & 0 deletions src/data/apps/imageClassification.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
{
"rfInstance": {
"nodes": [
{
"width": 208,
"height": 116,
"id": "HUGGING_FACE_PIPELINE-160a47cc-72e8-4088-a4af-43efdc9904d6",
"type": "AI_ML",
"data": {
"id": "HUGGING_FACE_PIPELINE-160a47cc-72e8-4088-a4af-43efdc9904d6",
"label": "HUGGING FACE PIPELINE",
"func": "HUGGING_FACE_PIPELINE",
"type": "AI_ML",
"ctrls": {
"model": {
"type": "str",
"default": "google/vit-base-patch16-224",
"desc": "The model to be used for classification.\nIf not specified, Vision Transformers (i.e. `google/vit-base-patch16-224`) are used.\nFor more information about Vision Transformers, see: https://huggingface.co/google/vit-base-patch16-224\nFor a complete list of models see: https://huggingface.co/models?pipeline_tag=image-classification",
"functionName": "HUGGING_FACE_PIPELINE",
"param": "model",
"value": "google/vit-base-patch16-224"
},
"revision": {
"type": "str",
"default": "main",
"desc": "The revision of the model to be used for classification.\nIf not specified, main is `used`. For instance see: https://huggingface.co/google/vit-base-patch16-224/commits/main",
"functionName": "HUGGING_FACE_PIPELINE",
"param": "revision",
"value": "main"
}
},
"initCtrls": {},
"inputs": [
{
"name": "default",
"id": "default",
"type": "Image",
"multiple": false,
"desc": "The input image to be classified. The image must be a PIL.Image object wrapped in a flojoy Image object."
}
],
"outputs": [
{
"name": "default",
"id": "default",
"type": "DataFrame",
"desc": "A DataFrame containing as columns the `label` classification label and `score`, its confidence score.\nAll scores are between 0 and 1 and sum to 1."
}
],
"path": "PYTHON/nodes/AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/HUGGING_FACE_PIPELINE.py",
"selected": false
},
"position": {
"x": 101.6862937753346,
"y": 89.1192557532203
},
"selected": false,
"positionAbsolute": {
"x": 101.6862937753346,
"y": 89.1192557532203
},
"dragging": true
},
{
"width": 160,
"height": 160,
"id": "LOCAL_FILE-3955f404-af77-4878-afd4-dab779ec5df2",
"type": "LOADERS",
"data": {
"id": "LOCAL_FILE-3955f404-af77-4878-afd4-dab779ec5df2",
"label": "LOCAL FILE",
"func": "LOCAL_FILE",
"type": "LOADERS",
"ctrls": {
"file_path": {
"type": "str",
"default": null,
"desc": "path to the file to be loaded",
"functionName": "LOCAL_FILE",
"param": "file_path",
"value": "./PYTHON/nodes/AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/assets/ada_lovelace.png"
},
"file_type": {
"type": "select",
"default": "Image",
"options": [
"Image",
"Grayscale",
"JSON",
"CSV",
"Excel",
"XML"
],
"desc": "type of file to load, default = image",
"functionName": "LOCAL_FILE",
"param": "file_type",
"value": "Image"
}
},
"initCtrls": {},
"outputs": [
{
"name": "default",
"id": "default",
"type": "Image|DataFrame",
"desc": "Image for file_type 'image'\nDataFrame for file_type 'json', 'csv', 'excel', 'xml'"
}
],
"pip_dependencies": [
{
"name": "xlrd",
"v": "2.0.1"
},
{
"name": "lxml",
"v": "4.9.2"
},
{
"name": "openpyxl",
"v": "3.0.10"
},
{
"name": "scikit-image",
"v": "0.21.0"
}
],
"path": "PYTHON/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/LOCAL_FILE.py",
"selected": true
},
"position": {
"x": -405.26756052777466,
"y": -122.64869035489248
},
"selected": true,
"positionAbsolute": {
"x": -405.26756052777466,
"y": -122.64869035489248
},
"dragging": true
},
{
"width": 380,
"height": 293,
"id": "TABLE-b1ca06f2-ecee-4858-a075-cdfb097be848",
"type": "VISUALIZERS",
"data": {
"id": "TABLE-b1ca06f2-ecee-4858-a075-cdfb097be848",
"label": "TABLE",
"func": "TABLE",
"type": "VISUALIZERS",
"ctrls": {},
"initCtrls": {},
"inputs": [
{
"name": "default",
"id": "default",
"type": "OrderedTriple|OrderedPair|DataFrame|Vector",
"multiple": false,
"desc": "the DataContainer to be visualized"
}
],
"outputs": [
{
"name": "default",
"id": "default",
"type": "Plotly",
"desc": "the DataContainer containing Plotly Table visualization"
}
],
"path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py",
"selected": false
},
"position": {
"x": 611.2887869229049,
"y": -262.3069439209832
},
"selected": false,
"positionAbsolute": {
"x": 611.2887869229049,
"y": -262.3069439209832
},
"dragging": true
},
{
"width": 380,
"height": 293,
"id": "IMAGE-b9af5a25-af44-43cd-bc00-315e08b0088f",
"type": "VISUALIZERS",
"data": {
"id": "IMAGE-b9af5a25-af44-43cd-bc00-315e08b0088f",
"label": "IMAGE",
"func": "IMAGE",
"type": "VISUALIZERS",
"ctrls": {},
"initCtrls": {},
"inputs": [
{
"name": "default",
"id": "default",
"type": "Image|Grayscale",
"multiple": false,
"desc": "the DataContainer to be visualized"
}
],
"outputs": [
{
"name": "default",
"id": "default",
"type": "Plotly",
"desc": "the DataContainer containing Plotly Image visualization of the input image"
}
],
"path": "PYTHON/nodes/VISUALIZERS/PLOTLY/IMAGE/IMAGE.py",
"selected": false
},
"position": {
"x": 53.6972076118181,
"y": -424.18710772887835
},
"selected": false,
"positionAbsolute": {
"x": 53.6972076118181,
"y": -424.18710772887835
},
"dragging": true
}
],
"edges": [
{
"source": "LOCAL_FILE-3955f404-af77-4878-afd4-dab779ec5df2",
"sourceHandle": "default",
"target": "HUGGING_FACE_PIPELINE-160a47cc-72e8-4088-a4af-43efdc9904d6",
"targetHandle": "default",
"id": "reactflow__edge-LOCAL_FILE-3955f404-af77-4878-afd4-dab779ec5df2default-HUGGING_FACE_PIPELINE-160a47cc-72e8-4088-a4af-43efdc9904d6default"
},
{
"source": "HUGGING_FACE_PIPELINE-160a47cc-72e8-4088-a4af-43efdc9904d6",
"sourceHandle": "default",
"target": "TABLE-b1ca06f2-ecee-4858-a075-cdfb097be848",
"targetHandle": "default",
"id": "reactflow__edge-HUGGING_FACE_PIPELINE-160a47cc-72e8-4088-a4af-43efdc9904d6default-TABLE-b1ca06f2-ecee-4858-a075-cdfb097be848default"
},
{
"source": "LOCAL_FILE-3955f404-af77-4878-afd4-dab779ec5df2",
"sourceHandle": "default",
"target": "IMAGE-b9af5a25-af44-43cd-bc00-315e08b0088f",
"targetHandle": "default",
"id": "reactflow__edge-LOCAL_FILE-3955f404-af77-4878-afd4-dab779ec5df2default-IMAGE-b9af5a25-af44-43cd-bc00-315e08b0088fdefault"
}
],
"viewport": {
"x": 1105.0678207150697,
"y": 575.2550328315427,
"zoom": 1.2199420644594634
}
}
}
12 changes: 12 additions & 0 deletions src/utils/GalleryLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ const data: GalleryData = {
},
],
},
{
title: "Image Classification",
description: "Classify any image using Hugging Face Transformers",
imagePath: "/assets/appGallery/imageClassification.png",
appPath: "imageClassification",
relevantNodes: [
{
name: "HUGGING_FACE_PIPELINE",
docs: "https://docs.flojoy.ai/nodes/AI_ML/IMAGE_CLASSIFICATION/HUGGING_FACE_PIPELINE/",
},
],
},
// {
// description: "Predict future events with the Prophet node",
// title: "Time series forecasting",
Expand Down

0 comments on commit bc112fa

Please sign in to comment.