Skip to content

Commit 5cd3948

Browse files
author
Chris Maunder
committed
Merge branch 'v2.7.0' of https://github.com/codeproject/CodeProject.AI-Server into v2.7.0
2 parents d198ce7 + 4063604 commit 5cd3948

33 files changed

Lines changed: 257 additions & 131 deletions

‎.vscode/launch.json‎

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@
285285
"hidden": false
286286
},
287287
"name": "ALPR",
288-
"type": "python",
289-
"python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ALPR/bin/linux/python38/venv/bin/python",
288+
"type": "debugpy",
289+
"python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ALPR/bin/windows/python39/venv/Scripts/python.exe",
290290
"request": "launch",
291291
"program": "ALPR_adapter.py",
292292
// "args": [ "--selftest" ],
@@ -300,7 +300,7 @@
300300
"CPAI_PORT": "32168"
301301
},
302302
"windows": {
303-
"python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ALPR/bin/windows/python39/venv/Scripts/python"
303+
"python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ALPR/bin/windows/python39/venv/Scripts/python.exe"
304304
},
305305
"linux": {
306306
"python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ALPR/bin/linux/python38/venv/bin/python",
@@ -447,13 +447,14 @@
447447
"hidden": false
448448
},
449449
"name": "Object Detect Coral",
450-
"type": "python",
451-
"python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ObjectDetectionCoral/bin/windows/python39/venv/Scripts/python.exe",
450+
"type": "debugpy",
451+
// "python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ObjectDetectionCoral/bin/windows/python39/venv/Scripts/python.exe",
452+
"python": "${workspaceFolder}/bin/windows/python39/venv/Scripts/python.exe",
452453
"request": "launch",
453454
"program": "objectdetection_coral_adapter.py",
454455
// "args": [ "--selftest" ],
455456
"console": "integratedTerminal",
456-
"cwd": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ObjectDetectionCoral",
457+
"cwd": "${workspaceFolder}",
457458
"justMyCode": false,
458459
"env": {
459460
"DEBUG_IN_VSCODE": "True",
@@ -476,7 +477,7 @@
476477
// "CPAI_CORAL_MULTI_TPU": "true",
477478
// "CPAI_CORAL_MODEL_NAME": "EfficientDet-Lite",
478479
// "MODEL_SIZE": "Medium"
479-
},
480+
}/*,
480481
"windows": {
481482
"python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ObjectDetectionCoral/bin/windows/python39/venv/Scripts/python.exe",
482483
},
@@ -485,7 +486,7 @@
485486
},
486487
"osx": {
487488
"python": "${workspaceFolder}/../CodeProject.AI-Modules/CodeProject.AI-ObjectDetectionCoral/bin/macos/python39/venv/bin/python",
488-
}
489+
}*/
489490
},
490491

491492
{
@@ -990,7 +991,7 @@
990991
"console": "internalConsole",
991992
"request": "launch",
992993
"preLaunchTask": "build-parsejson",
993-
"cwd": "${workspaceFolder}/src/SDK/Utilities/ParseJSON/",
994+
"cwd": "${workspaceFolder}/utils/ParseJSON/",
994995
"env": {
995996
"ASPNETCORE_ENVIRONMENT": "Development"
996997
}
@@ -1005,12 +1006,12 @@
10051006
"type": "coreclr",
10061007
"request": "launch",
10071008
"preLaunchTask": "build-parsejson",
1008-
"program": "${workspaceFolder}/src/SDK/Utilities/ParseJSON/bin/Debug/net7.0/ParseJSON",
1009+
"program": "${workspaceFolder}/utils/ParseJSON/bin/Debug/net7.0/ParseJSON",
10091010
"linux": {
1010-
"program": "${workspaceFolder}/src/SDK/Utilities/ParseJSON/bin/Debug/net7.0/ParseJSON.dll",
1011+
"program": "${workspaceFolder}/utils/ParseJSON/bin/Debug/net7.0/ParseJSON.dll",
10111012
},
10121013
"args": [ "$.Modules.ALPR.Platforms", "test.json" ],
1013-
"cwd": "${workspaceFolder}/src/SDK/Utilities/ParseJSON/",
1014+
"cwd": "${workspaceFolder}/utils/ParseJSON/",
10141015
"stopAtEntry": false,
10151016
"requireExactSource": false,
10161017
"env": {

‎.vscode/tasks.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
"command": "dotnet",
108108
"args": [
109109
"build",
110-
"${workspaceFolder}/src/SDK/Utilities/ParseJSON",
110+
"${workspaceFolder}/utils/ParseJSON",
111111
"/property:GenerateFullPaths=true",
112112
"/consoleloggerparameters:NoSummary"
113113
],

‎CodeProject.AI.sln‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{
195195
src\SDK\Utilities\stop_all.sh = src\SDK\Utilities\stop_all.sh
196196
EndProjectSection
197197
EndProject
198-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ParseJSON", "src\SDK\Utilities\ParseJSON\ParseJSON.csproj", "{AF84AA51-8718-40EC-B5D7-281799A7B07C}"
198+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ParseJSON", "utils\ParseJSON\ParseJSON.csproj", "{AF84AA51-8718-40EC-B5D7-281799A7B07C}"
199199
EndProject
200200
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "clients", "clients", "{5FBE5A09-30BA-4697-8069-443BE5294424}"
201201
ProjectSection(SolutionItems) = preProject

‎README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ transfer, and is easy to use.
3838

3939
### 2: Running and debugging the code
4040

41-
1. Clone the CodeProject.AI repository.
41+
1. Clone the CodeProject.AI-Server repository.
4242
2. Make sure you have Visual Studio Code or Visual Studio 2019+ installed.
43-
3. Run the setup script in /Installers/Dev
44-
4. Debug the front-end server application (see notes below, but it's easy)
43+
3. Run the setup script in /devops/install
44+
4. Optionally pull all CodeProject.AI Modules by running the clone_repos script in /devops/install
45+
5. Debug the front-end server application (see notes below, but it's easy)
4546

4647

4748
## How do I use it in my application?

‎devops/build/create_packages.bat‎

Lines changed: 70 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ set includeDotNet=true
2626
:: Width of lines
2727
set lineWidth=70
2828

29+
::set debug_json_parse=true
30+
2931

3032
:: Basic locations
3133

@@ -53,32 +55,41 @@ set thisScriptDirPath=%~dp0
5355
pushd %thisScriptDirPath%..\..
5456
set rootDirPath=%cd%
5557
popd
56-
set sdkDirPath=%rootDirPath%\%srcDir%\%sdkDir%
57-
set sdkScriptsDirPath=%sdkDirPath%\Scripts
58-
58+
set sdkPath=%rootDirPath%\%srcDir%\%sdkDir%
59+
set sdkScriptsDirPath=%sdkPath%\Scripts
5960

6061
:: Override some values via parameters ::::::::::::::::::::::::::::::::::::::::
6162

6263
:param_loop
63-
set arg_name=%~1
64-
set arg_value=%~2
65-
if not "!arg_name!" == "" (
66-
if not "!arg_name:--no-color=!" == "!arg_name!" set useColor=false
67-
if not "!arg_name:--no-dotnet=!" == "!arg_name!" set includeDotNet=false
68-
69-
REM No longer supporting this scenario
70-
REM if not "!arg_name:--path-to-setup=!" == "!arg_name!" (
71-
REM set setupScriptDirPath=!arg_value!
72-
REM shift
73-
REM )
74-
75-
if not "!arg_name:--verbosity=!" == "!arg_name!" (
76-
set verbosity=!arg_value!
77-
shift
64+
if "%~1"=="" goto :end_param_loop
65+
if "%~1"=="--verbosity" (
66+
set "verbosity=%~2"
67+
if /i "!verbosity!" neq "loud" if /i "!verbosity!" neq "info" if /i "!verbosity!" neq "quiet" (
68+
set verbosity=quiet
7869
)
70+
shift
71+
shift
72+
goto :param_loop
73+
)
74+
if "%~1"=="--no-dotnet" (
75+
set includeDotNet=false
76+
shift
77+
goto :param_loop
7978
)
79+
if "%~1"=="--no-color" (
80+
set useColor=false
81+
shift
82+
goto :param_loop
83+
)
84+
REM No longer supporting this scenario
85+
REM if "%~1"=="--path-to-setup" (
86+
REM set "setupScriptDirPath=%~2"
87+
REM shift
88+
REM shift
89+
REM goto :param_loop
90+
REM )
8091
shift
81-
if not "!arg_name!"=="" goto param_loop
92+
:end_param_loop
8293

8394

8495
:: The location of directories relative to the root of the solution directory
@@ -104,8 +115,9 @@ call "!sdkScriptsDirPath!\utils.bat" WriteLine
104115

105116
if /i "%verbosity%" neq "quiet" (
106117
call "!sdkScriptsDirPath!\utils.bat" WriteLine
107-
call "!sdkScriptsDirPath!\utils.bat" WriteLine "rootDirPath = !rootDirPath!" !color_mute!
108-
call "!sdkScriptsDirPath!\utils.bat" WriteLine "setupScriptDirPath = !setupScriptDirPath!" !color_mute!
118+
call "!sdkScriptsDirPath!\utils.bat" WriteLine "rootDirPath = !rootDirPath!" !color_mute!
119+
call "!sdkScriptsDirPath!\utils.bat" WriteLine "thisScriptDirPath = !thisScriptDirPath!" !color_mute!
120+
call "!sdkScriptsDirPath!\utils.bat" WriteLine "sdkPath = !sdkPath!" !color_mute!
109121
call "!sdkScriptsDirPath!\utils.bat" WriteLine "sdkScriptsDirPath = !sdkScriptsDirPath!" !color_mute!
110122
call "!sdkScriptsDirPath!\utils.bat" WriteLine "modulesDirPath = !modulesDirPath!" !color_mute!
111123
call "!sdkScriptsDirPath!\utils.bat" WriteLine "externalModulesDirPath = !externalModulesDirPath!" !color_mute!
@@ -116,10 +128,16 @@ if /i "%verbosity%" neq "quiet" (
116128

117129
set success=true
118130

119-
pushd %sdkDirPath%\Utilities\ParseJSON
131+
pushd "!rootDirPath!\utils\ParseJSON"
132+
cd
120133
if not exist ParseJSON.exe (
121-
dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release >NUL
122-
if exist .\bin\Release\net7.0\ move .\bin\Release\net7.0\* . >nul
134+
if /i "%verbosity%" neq "quiet" (
135+
dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release
136+
if exist .\bin\Release\net7.0\ move .\bin\Release\net7.0\* .
137+
) else (
138+
dotnet build /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary -c Release >NUL
139+
if exist .\bin\Release\net7.0\ move .\bin\Release\net7.0\* . >nul
140+
)
123141
)
124142
popd
125143

@@ -131,12 +149,11 @@ for /f "delims=" %%D in ('dir /a:d /b "!modulesDirPath!"') do (
131149
set packageModuleDirName=%%~nxD
132150
set packageModuleDirPath=!modulesDirPath!\!packageModuleDirName!
133151

134-
REM Bad assumption: A module's ID is same as the name of folder in which it lives.
135-
REM set packageModuleId=!packageModuleDirName!
136-
137152
call "!sdkScriptsDirPath!\utils.bat" GetModuleIdFromModuleSettingsFile "!packageModuleDirPath!\modulesettings.json"
138153
set packageModuleId=!moduleSettingValue!
139154

155+
if /i "%verbosity%" neq "quiet" call "!sdkScriptsDirPath!\utils.bat" WriteLine "Processing !packageModuleDirName! (!packageModuleId!)"
156+
140157
if "!packageModuleId!" neq "" (
141158
call :DoModulePackage "!packageModuleId!" "!packageModuleDirName!" "!packageModuleDirPath!" errors
142159
if "!moduleInstallErrors!" NEQ "" set success=false
@@ -146,14 +163,13 @@ for /f "delims=" %%D in ('dir /a:d /b "!modulesDirPath!"') do (
146163
for /f "delims=" %%D in ('dir /a:d /b "!externalModulesDirPath!"') do (
147164

148165
set packageModuleDirName=%%~nxD
149-
set packageModuleDirPath=!modulesDirPath!\!packageModuleDirName!
150-
151-
REM Bad assumption: A module's ID is same as the name of folder in which it lives.
152-
REM set packageModuleId=!packageModuleDirName!
166+
set packageModuleDirPath=!externalModulesDirPath!\!packageModuleDirName!
153167

154168
call "!sdkScriptsDirPath!\utils.bat" GetModuleIdFromModuleSettingsFile "!packageModuleDirPath!\modulesettings.json"
155169
set packageModuleId=!moduleSettingValue!
156170

171+
if /i "%verbosity%" neq "quiet" call "!sdkScriptsDirPath!\utils.bat" WriteLine "Processing !packageModuleDirName! (!packageModuleId!)"
172+
157173
if "!packageModuleId!" neq "" (
158174
call :DoModulePackage "!packageModuleId!" "!packageModuleDirName!" "!packageModuleDirPath!" errors
159175
if "!moduleInstallErrors!" NEQ "" set success=false
@@ -199,38 +215,38 @@ REM Creates a package for a module
199215
call "!sdkScriptsDirPath!\utils.bat" Write "Preparing !packageModuleId!..."
200216
call "!sdkScriptsDirPath!\utils.bat" GetValueFromModuleSettingsFile "!packageModuleDirPath!", "!packageModuleId!", "Version"
201217
set packageVersion=!moduleSettingsFileValue!
202-
)
203218

204-
if "!packageVersion!" == "" (
205-
call "!sdkScriptsDirPath!\utils.bat" WriteLine "Unable to read version from modulesettings file. Skipping" "Red"
206-
) else if "!doPackage!" == "true" (
219+
if "!packageVersion!" == "" (
220+
call "!sdkScriptsDirPath!\utils.bat" WriteLine "Unable to read version from modulesettings file. Skipping" "Red"
221+
) else (
207222

208-
pushd "!packageModuleDirPath!"
209-
if /i "%verbosity%" == "loud" cd
223+
pushd "!packageModuleDirPath!"
224+
if /i "%verbosity%" == "loud" cd
210225

211-
rem Create module download package
212-
if exist package.bat (
213-
call "!sdkScriptsDirPath!\utils.bat" Write "Packaging !packageModuleId! !packageVersion!..." "White"
214-
call package.bat !packageModuleId! !packageVersion!
215-
if errorlevel 1 call "!sdkScriptsDirPath!\utils.bat" WriteLine "Error in package.bat for !packageModuleDirName!" "Red"
226+
rem Create module download package
227+
if exist package.bat (
228+
call "!sdkScriptsDirPath!\utils.bat" Write "Packaging !packageModuleId! !packageVersion!..." "White"
229+
call package.bat !packageModuleId! !packageVersion!
230+
if errorlevel 1 call "!sdkScriptsDirPath!\utils.bat" WriteLine "Error in package.bat for !packageModuleDirName!" "Red"
216231

217-
rem Move package into modules download cache
232+
rem Move package into modules download cache
218233

219-
rem echo Moving !packageModuleDirPath!\!packageModuleId!-!version!.zip to !downloadDirPath!\!modulesDir!\
220-
move /Y !packageModuleDirPath!\!packageModuleId!-!packageVersion!.zip !downloadDirPath!\!modulesDir!\ >NUL
234+
rem echo Moving !packageModuleDirPath!\!packageModuleId!-!version!.zip to !downloadDirPath!\!modulesDir!\
235+
move /Y !packageModuleDirPath!\!packageModuleId!-!packageVersion!.zip !downloadDirPath!\!modulesDir!\ >NUL
221236

222-
if errorlevel 1 (
223-
call "!sdkScriptsDirPath!\utils.bat" WriteLine "Error" "Red"
224-
set success=false
237+
if errorlevel 1 (
238+
call "!sdkScriptsDirPath!\utils.bat" WriteLine "Error" "Red"
239+
set success=false
240+
) else (
241+
call "!sdkScriptsDirPath!\utils.bat" WriteLine "done" "DarkGreen"
242+
)
225243
) else (
226-
call "!sdkScriptsDirPath!\utils.bat" WriteLine "done" "DarkGreen"
244+
call "!sdkScriptsDirPath!\utils.bat" WriteLine "No package.bat file found..." "Red"
227245
)
228-
) else (
229-
call "!sdkScriptsDirPath!\utils.bat" WriteLine "No package.bat file found..." "Red"
230-
)
231246

232-
popd
233-
)
247+
popd
248+
)
249+
)
234250
)
235251

236252
exit /b

‎devops/build/create_packages.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ thisScriptDirPath="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
5454
pushd "${thisScriptDirPath}/../.." >/dev/null
5555
rootDirPath="$(pwd)"
5656
popd >/dev/null
57-
sdkDirPath="${rootDirPath}/${srcDirName}/${sdkDir}"
58-
sdkScriptsDirPath="${sdkDirPath}/Scripts"
57+
sdkPath="${rootDirPath}/${srcDirName}/${sdkDir}"
58+
sdkScriptsDirPath="${sdkPath}/Scripts"
5959

6060
# Override some values via parameters ::::::::::::::::::::::::::::::::::::::::::
6161

‎devops/install/clean.bat‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:: Usage:
44
:: clean [build | install | installall | downloads | all]
55
::
6-
:: We assume we're in the /Installers/Dev directory
6+
:: We assume we're in the /devops/install directory
77

88
@echo off
99
cls
@@ -24,9 +24,9 @@ set lineWidth=70
2424
set dotNetModules=ObjectDetectionYOLOv5Net
2525
set pythonModules=ObjectDetectionYOLOv5-6.2
2626

27-
set dotNetExternalModules=PortraitFilter SentimentAnalysis
27+
set dotNetExternalModules=CodeProject.AI-PortraitFilter CodeProject.AI-SentimentAnalysis
2828
set pythonExternalModules=CodeProject.AI-ALPR CodeProject.AI-ALPR-RKNN CodeProject.AI-BackgroundRemover ^
29-
CodeProject.AI-Cartooniser CodeProject.AI-FaceProcessing CodeProject.AI-LlamaChat ^
29+
CodeProject.AI-Cartoonizer CodeProject.AI-FaceProcessing CodeProject.AI-LlamaChat ^
3030
CodeProject.AI-ObjectDetectionCoral CodeProject.AI-ObjectDetectionYOLOv5-3.1 ^
3131
CodeProject.AI-ObjectDetectionYOLOv8 CodeProject.AI-ObjectDetectionYoloRKNN ^
3232
CodeProject.AI-TrainingObjectDetectionYOLOv5 CodeProject.AI-OCR ^
@@ -127,13 +127,13 @@ if /i "%cleanBuild%" == "true" (
127127
call :CleanSubDirs "!rootDir!\Installers\Windows\" "\obj\Debug\"
128128
call :CleanSubDirs "!rootDir!\Installers\Windows\" "\obj\Release\"
129129

130-
call :RemoveDir "!rootDir!\src\SDK\Utilities\ParseJSON\bin"
131-
call :RemoveDir "!rootDir!\src\SDK\Utilities\ParseJSON\obj"
132-
del "!rootDir!\src\SDK\Utilities\ParseJSON\ParseJSON.deps.json"
133-
del "!rootDir!\src\SDK\Utilities\ParseJSON\ParseJSON.dll"
134-
del "!rootDir!\src\SDK\Utilities\ParseJSON\ParseJSON.exe"
135-
del "!rootDir!\src\SDK\Utilities\ParseJSON\ParseJSON.runtimeconfig.json"
136-
del "!rootDir!\src\SDK\Utilities\ParseJSON\ParseJSON.xml"
130+
call :RemoveDir "!rootDir!\utils\ParseJSON\bin"
131+
call :RemoveDir "!rootDir!\utils\ParseJSON\obj"
132+
del "!rootDir!\utils\ParseJSON\ParseJSON.deps.json"
133+
del "!rootDir!\utils\ParseJSON\*.dll"
134+
del "!rootDir!\utils\ParseJSON\ParseJSON.exe"
135+
del "!rootDir!\utils\ParseJSON\ParseJSON.runtimeconfig.json"
136+
del "!rootDir!\utils\ParseJSON\ParseJSON.xml"
137137

138138
call :CleanSubDirs "!rootDir!\src\demos\clients\" "\bin\Debug\"
139139
call :CleanSubDirs "!rootDir!\src\demos\clients\" "\bin\Release\"
@@ -212,7 +212,7 @@ if /i "%cleanAssets%" == "true" (
212212
call :RemoveDir "!externalModulesDir!\CodeProject.AI-ALPR\paddleocr"
213213
call :RemoveDir "!externalModulesDir!\CodeProject.AI-ALPR-RKNN\paddleocr"
214214
call :RemoveDir "!externalModulesDir!\CodeProject.AI-BackgroundRemover\models"
215-
call :RemoveDir "!externalModulesDir!\CodeProject.AI-Cartooniser\weights"
215+
call :RemoveDir "!externalModulesDir!\CodeProject.AI-Cartoonizer\weights"
216216
call :RemoveDir "!externalModulesDir!\CodeProject.AI-FaceProcessing\assets"
217217
call :RemoveDir "!externalModulesDir!\CodeProject.AI-LlamaChat\models"
218218
call :RemoveDir "!externalModulesDir!\CodeProject.AI-ObjectDetectionYOLOv5-3.1\assets"

0 commit comments

Comments
 (0)