{"id":15158258,"url":"https://github.com/arrrsunny/blockyai","last_synced_at":"2026-02-03T14:32:19.946Z","repository":{"id":254802875,"uuid":"847346810","full_name":"ARRRsunny/BlockyAI","owner":"ARRRsunny","description":"This is the educational project that allow user to build up their own AI model with various blocks:","archived":false,"fork":false,"pushed_at":"2025-06-13T12:38:37.000Z","size":24853,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T08:11:39.488Z","etag":null,"topics":["ai","blocks","keras","python3","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/ARRRsunny.png","metadata":{"files":{"readme":"README.md","changelog":"history_ver/BlockyAI_local_demo.py","contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-08-25T15:11:10.000Z","updated_at":"2025-06-13T12:38:40.000Z","dependencies_parsed_at":"2025-04-07T15:47:47.736Z","dependency_job_id":"39d67fc6-9d9d-49d0-9993-736a52e3117c","html_url":"https://github.com/ARRRsunny/BlockyAI","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"5fb8fd2f18889444a092533dcc7213aa3a966336"},"previous_names":["arrrsunny/blockyai"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/ARRRsunny/BlockyAI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARRRsunny%2FBlockyAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARRRsunny%2FBlockyAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARRRsunny%2FBlockyAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARRRsunny%2FBlockyAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ARRRsunny","download_url":"https://codeload.github.com/ARRRsunny/BlockyAI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARRRsunny%2FBlockyAI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262362050,"owners_count":23299119,"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":["ai","blocks","keras","python3","tensorflow"],"created_at":"2024-09-26T20:41:59.649Z","updated_at":"2026-02-03T14:32:19.929Z","avatar_url":"https://github.com/ARRRsunny.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BlockyAI\n\nBlockyAI is a drag-and-drop GUI application designed to empower senior developers, AI learners, and educators to easily create, visualize, and execute machine learning models. Inspired by tools like Micro:bit, BlockyAI simplifies the process of building AI models, making it accessible for all — even for primary school students. This tool encourages hands-on learning and teaching of AI concepts in a fun and interactive way.\n\n![BlockyAI](https://github.com/ARRRsunny/BlockyAI/blob/main/asset/image.png)\n## Purpose\n\nThe primary goal of BlockyAI is to make AI accessible to everyone, regardless of their programming expertise. Whether you're:\n\n- **A senior coder**: Quickly prototype machine learning models and generate Python code.\n- **A beginner learning AI**: Experiment with AI concepts without worrying about the technical details of code syntax.\n- **An educator**: Teach AI concepts to students using visual blocks, enabling them to build their own models easily.\n\nBlockyAI is an ideal platform for introducing young learners to AI, inspiring a new generation of AI enthusiasts by making complex concepts simple and approachable.\n\n---\n\n## Features\n\n- **Drag-and-Drop Visual Blocks**: Create machine learning models by dragging and connecting blocks that represent neural network layers.\n- **Code Generation**: Automatically generates Python code based on the visual model, enabling users to see the real implementation behind their designs.\n- **Model Visualization**: Real-time graphical representation of the model's architecture.\n- **Educational Focus**: Designed for teaching and learning AI concepts, making it easy for educators to explain and learners to explore.\n- **Support for Common AI Layers**:\n  - Dense Layer\n  - Conv2D Layer\n  - Flatten\n  - Activation\n  - Resizing Layer\n  - Dropout\n  - BatchNormalization\n  - AveragePooling2D\n  - MaxPooling2D\n  - Output Layer\n- **Run Models Directly**: Execute the generated Python code directly from the application.\n- **Settings Configuration**: Adjust dataset, optimizer, batch size, epochs, and learning rate to customize training.\n\n---\n\n## Why BlockyAI?\n\nBlockyAI lowers the barrier to entry for understanding and experimenting with AI. It’s like using Micro:bit for coding or Scratch for programming — simple, visual, and interactive. With BlockyAI, even primary school students can start building and training their own neural networks, making it the perfect tool for:\n\n- **Students**: Learn AI concepts visually and experiment with models.\n- **Teachers**: Teach AI in a classroom setting with an engaging and interactive tool.\n- **Professionals**: Prototype models quickly and focus on creativity rather than syntax.\n\n---\n\n## How to Use\n\n### Prerequisites\n\nEnsure the following dependencies are installed:\n\n- **Python 3.10 or above**\n- **TensorFlow 2.17 or higher**\n- **OpenCV 4.10 or higher**\n- **Numpy 1.26 or higher**\n\n### Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/ARRRsunny/BlockyAI.git\n   cd BlockyAI\n   ```\n\n2. Install the required Python dependencies:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. Adjust to destination IP and Port(Optional):\n   ```bash\n   Address = '0.0.0.0'\n   Port = 5000\n   ```\n### Running the Application\n\n1. Run the `server.py` file:\n   ```bash\n   python server.py\n   ```\n\n2. Start building your model:\n   - Drag blocks from the **Blocks Holder** to the **Canvas**.\n   - Customize settings for individual blocks (e.g., number of units, resizing dimensions).\n   - Connect blocks to define the model's flow.\n\n3. Use the **Settings Panel** to configure:\n   - Dataset\n   - Optimizer\n   - Batch size\n   - Epochs\n   - Learning rate\n\n4. View the model's architecture in the **Model Visualization Area**.\n\n5. Click **Run** in the Code Display Area to generate and execute the Python code for your model.\n   - A loading bar will be shown and you just need to wait for the model to be finished.\n\n6. Click **Download Train Model** for downloading model\n\n### Using Your Own Trained Model\n\n1. Running Model through our website\n   - Click the **Get QR Code** and copy your **Model ID**.\n   - Click the **Click to test** to redirect the **Test Panel** page.\n   - Input your **Model ID** and start testing the model.\n\n---\n\n## Block Types\n\n| Block Name                   | Input Field | Resize Field | Deletable | Description                                                                 |\n|------------------------------|-------------|--------------|-----------|-----------------------------------------------------------------------------|\n| Starting Block               | No          | No           | No        | The entry point of the model. Cannot be deleted.                           |\n| Dense Layer                  | Yes         | No           | Yes       | Fully connected layer with customizable number of units.                   |\n| Conv2D Layer                 | Yes         | No           | Yes       | Convolutional layer with customizable number of filters.                   |\n| Flatten                      | No          | No           | Yes       | Flattens the input to a 1D vector.                                         |\n| Activation                   | No          | No           | Yes       | Applies an activation function (default: ReLU).                            |\n| Resizing Layer               | No          | Yes          | Yes       | Resizes the input to specified dimensions (width, height).                 |\n| AveragePooling2D Layer       | No          | No           | Yes       | Reduces spatial dimensions by taking the average over a pooling window.    |\n| MaxPooling2D Layer           | No          | No           | Yes       | Reduces spatial dimensions by taking the maximum over a pooling window.    |\n| BatchNormalization Layer     | No          | No           | Yes       | Normalizes the input across the batch.                                     |\n| Dropout                      | Yes         | No           | Yes       | Applies dropout regularization with a customizable dropout rate.           |\n\n---\n\n## Example Workflow\n\n### Building a Simple Model\n\n1. Drag the following blocks onto the canvas:\n   - **Starting Block**\n   - **Conv2D Layer** (set filters to 32)\n   - **MaxPooling2D Layer**\n   - **Flatten**\n   - **Dense Layer** (set units to 128)\n   - **Output Layer**\n\n2. Configure the settings:\n   - Dataset: `mnist`\n   - Optimizer: `Adam`\n   - Batch Size: `32`\n   - Epochs: `5`\n   - Learning Rate: `0.001`\n\n3. Click **Run** to train the model and see predictions.\n\n---\n\n## Code Generation\n\nBlockyAI generates Python code that includes:\n\n- Dataset loading and preprocessing\n- Model architecture definition\n- Model compilation and training\n- Random prediction and result visualization using OpenCV\n\n### Example Generated Code\n\nHere’s a snippet of the kind of code BlockyAI generates:\n\n```python\n\nimport tensorflow as tf\nfrom tensorflow.keras.layers import *\nfrom tensorflow.keras.optimizers import *\nfrom tensorflow.keras.callbacks import *\nimport numpy as np\nimport cv2\n\ntf.keras.backend.clear_session()\n(x_train, y_train), (x_test, y_test) = tf.keras.datasets.fashion_mnist.load_data()\n\nx_train, x_test = x_train / 255.0, x_test / 255.0\nif len(x_train.shape) == 3:\n    x_train = x_train[..., tf.newaxis]\n    x_test = x_test[..., tf.newaxis]\n\nlabels = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat', 'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle boot']\nnum_classes = len(labels)\n\ntrain_one_hot = tf.keras.utils.to_categorical(y_train, num_classes)\ntest_one_hot = tf.keras.utils.to_categorical(y_test, num_classes)\n\ndef build_model(num_classes):\n    model = tf.keras.Sequential([\n        tf.keras.Input(shape=(28, 28, 1)),\n        Conv2D(32, kernel_size=(3, 3), activation='relu'),\n        AveragePooling2D(pool_size=(2, 2)),\n        Flatten(),\n        Dense(128, activation='relu'),\n        Dense(num_classes, activation='softmax')\n    ])\n    return model\n\nmodel = build_model(num_classes)\nmodel.compile(optimizer=Adam(learning_rate=0.001), loss=\"categorical_crossentropy\", metrics=[\"accuracy\"])\ncallbacks = [EarlyStopping(monitor='accuracy', patience=3)]\nmodel.fit(x_train, train_one_hot, batch_size=32, epochs=5, callbacks=callbacks, validation_data=(x_test, test_one_hot))\nprediction = model.predict(x_test)\n\nN = np.random.randint(0, high=len(x_test), dtype=int)\n\nprint(f'sum: {np.sum(prediction, axis=1)}')\nprint(f'predict index: {np.argmax(prediction, axis=1)}')\nprint(f'Predict: {labels[np.argmax(prediction, axis=1)[N]]}')\nprint(f'Correct: {labels[y_test[N]]}')\n\nimage = x_test[N]\nif image.shape[-1] == 1:\n    image = image.reshape(image.shape)\n\ncv2.namedWindow('img', cv2.WINDOW_NORMAL)\ncv2.resizeWindow('img',300,300)\ncv2.imshow('img',image)\ncv2.waitKey(0)\ncv2.destroyAllWindows()\n\n```\n\n---\n\n## Educational Benefits\n\n- **For Students**: Learn AI concepts visually, experiment with neural networks, and see the real-world impact of AI.\n- **For Teachers**: A powerful teaching tool to explain AI concepts interactively in classrooms.\n- **For Beginners**: A simplified introduction to AI without requiring prior coding experience.\n\n---\n\n## Contributing\n\nWe welcome contributions! Feel free to submit issues or pull requests on the [GitHub repository](https://github.com/ARRRsunny/BlockyAI).\n\n---\n\n## Credits\n\n- **Created by**: [@ARRRsunny](https://github.com/ARRRsunny), [@EVBAS](https://github.com/EVBAS)\n- **Inspiration**: Tools like Micro:bit, Scratch, and TensorFlow.\n\n---\n\n**Empowering the next generation of AI enthusiasts, one block at a time!**\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrrsunny%2Fblockyai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farrrsunny%2Fblockyai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrrsunny%2Fblockyai/lists"}