Most children with autism spectrum disorders (ASD) are visual learners. They tend to comprehend visual information better than auditory input, making visual supports more effective for their learning process.
The project was initiated due to the laborious creation of a visual card and a market demand for a better, cost-effective product. The aim is also to democratize AI, making it accessible to all and overcoming previous product limitations with the help of new technologies.
- Visual aids product in the market: Bing Search Results / Can be quite costly Amazon Search Result
- Applied behavior analysis (ABA) is a therapeutic approach for treating ASD.
- Visual aids in applied behavior analysis (ABA) URL
Important: The code in this repository was developed during a hackathon and implemented within a limited timeline. It is intended for demonstration purposes only.
- Switching between personas and modes of generation (List, Steps, Manual / Parents and Caregivers, Childs)
- Visual Card generation and management (Set the order of images by Drag and Drop)
- Vector Image search
- Video generation from images (To teach work procedures)
- Text-to-Image
git_preview.mp4
- Vector-based image search: Azure Cognitive Search & Computer Vision API for Vector embedding
- Text-to-image generation: Azure OpenAI GPT-3.5 & Image Generation by Azure OpenAI Dall-E
Due to the Generation speed issue, only the last image will be generated by Dall-E.
- Bing Image Search
- Fluent emoji dataset
- Azure Cognitive Services Speech to Text (Read the text on the card)
- [Optional] Microsoft Coco dataset (Everyday Life Images)
The test dataset for Vector Image Search. Vector search seeks images based on their features, not by the associated metadata tags or the image file name.
Note: Please ensure you have installed nodejs
and python3
.
To preview and run the project on your device:
- Open project folder in Visual Studio Code
- In the terminal, run
npm install
- Run
npm run dev
to view the project in a browser - Run
python app.py
to launch the backend.
!important: react-beautiful-dnd
was not able to work well with reactStrictMode: true
in NextJs.
Turn off the option at next.config.js
.`
-
The [Optional] steps are needed for demonstration purposes and are not mandatory for deploying the application.
-
Uploading your image data into Azure Blob Storage.
- [Optional] dataset > data > Upload to Blob image container
- dataset > emoji > Upload to Blob emoji container
-
Image and Category metadata are managed on SQL database.
- DB Creation:
backend\infra\db_postgres.sql
- [Optional] DB Data Generate:
backend\util\postgre_gen_db_data.py
- DB Creation:
-
Image search requires to creation of Azure Cognitive Search Index.
- Azure AI Search Index Creation:
backend\util\acs_index_gen.py
- [Optional] trigger indexer: The web skill (azure functions: acs_skillset_for_indexer) should be deployed before it is triggered.
- Azure AI Search Index Creation:
-
[Optional] Update and synchronize the 'sid' attribute in Azure Cognitive Search based on metadata from the SQL database.
backend\util\data_for_dev\acs_index_mapping_with_postgre.py
-
Data creation for development and Dataset. Please find the sample images in dataset
and backend\util
directories.
- Deployment can be done using Azure Template or Azure Bicep.
-
Azure Template
-
Click the template button.
-
Convert Bicep to Json: url
-
-
Azure Bicep
- Deploy Azure Resources >
backend\infra
Set up your parameters for Azure Bicep.
"prefix": { "value": "<your-value-for-prefix>" }, "pgsqlId": { "value": "<your-postgre-sql-id>" }, "pgsqlPwd": { "value": "<your-postgre-sql-password>" }
- Execute the script for Azure Bicep
PS> .\main.ps1 -resourceGroup <your-resource-group-name> -location <your-resource-location>
- Deploy Azure Resources >
- Build Next.js application
-
Execute the
npm run build
command. This will build UI code and createpublic
directory under thebackend
."scripts": { "dev": "next dev", "build": "next build && next export -o backend/public", "start": "next start", "lint": "next lint" }
-
The
.env.production
on root will be embedded into the javascript files.NEXT_PUBLIC_MS_CLARITY_ID= //[Optional] NEXT_PUBLIC_ENV_TYPE=prod
-
Upload UI and Python code to Azure App Service (by Visual Code Extension: Azure Tools)
- Navigate to Azure Tools (Visual Code Extension) > Resources > your Azure Subscription > App Service > your App service.
- Click on Deploy to Web app...
- Select the
backend
directory as the target directory.
-
To set up the start-up command at Azure App service.
-
Open your Web App in the Azure Portal (portal.azure.com).
-
Scroll to Configuration under Settings.
-
Click on the General Settings tab.
-
Enter the startup command.
python app.py
-
-
To set up environment variables in Azure App Service, you can follow these steps:
- In the Azure Portal, locate your App Service.
- On the left pane, click on "Configuration".
- Under "Application settings", click on "New application setting".
- Fill in the name and value for each environment variable:
- Click "OK", then at the top, click "Save".
-
Most of the values will be mapped during the deployment.
AZURE_SEARCH_SERVICE_ENDPOINT=https://?.search.windows.net AZURE_SEARCH_INDEX_NAME= AZURE_SEARCH_ADMIN_KEY= COGNITIVE_SERVICES_ENDPOINT=https://?.cognitiveservices.azure.com COGNITIVE_SERVICES_API_KEY= BLOB_CONNECTION_STRING= BLOB_CONTAINER_NAME= BLOB_EMOJI_CONTAINER_NAME= AZURE_OPENAI_ENDPOINT=https://?.openai.azure.com/ AZURE_OPENAI_API_KEY= AZURE_OPENAI_API_VERSION_IMG=2023-06-01-preview AZURE_OPENAI_API_VERSION_CHAT=2023-07-01-preview BING_IMAGE_SEARCH_KEY= SPEECH_SUBSCRIPTION_KEY= SPEECH_REGION= POSTGRE_HOST= POSTGRE_USER= POSTGRE_PORT=5432 POSTGRE_DATABASE= POSTGRE_PASSWORD= ENV_TYPE=PROD APP_SECRET_STRING= //JWT Token authentication key. e.g,. mysecret
-
[Optional]:
backend/util/env_to_app_service_fmt.py
: Convert the .env file to theappsettings.json
for settings in Azure App Service.[ { "name": "AZURE_SEARCH_SERVICE_ENDPOINT", "value": "https://?.search.windows.net" }, { ... } ... ]
-
PostgreSQL offers a vector search feature through the installation of the pgvector plugin. This feature can be utilized to implement image search, potentially serving as an alternative to Azure AI Search.