Skip to content

Commit c0dcbbb

Browse files
committed
Update Edge AI Studio (#806)
1 parent 11a555e commit c0dcbbb

File tree

87 files changed

+13831
-8380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+13831
-8380
lines changed

usecases/ai/edge-ai-studio/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@ tmp
3636
!/out/README.md
3737
!/out/run_web.sh
3838
!/out/setup.sh
39+
!/out/run_web.ps1
40+
!/out/setup.ps1

usecases/ai/edge-ai-studio/.vscode/extensions.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

usecases/ai/edge-ai-studio/.vscode/launch.json

Lines changed: 0 additions & 53 deletions
This file was deleted.

usecases/ai/edge-ai-studio/.vscode/settings.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

usecases/ai/edge-ai-studio/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ Edge AI Studio is a modern toolkit for deploying, managing, and serving AI model
1111
- **Easy Model Deployment:** Download, convert, and serve Hugging Face models with minimal setup.
1212
- **Web-Based Management:** Manage devices, workloads, and users through a modern web interface.
1313
- **Edge Optimized:** Built for Intel hardware and edge environments.
14-
14+
- **AI Services:** AI Services that users can use for their applications
15+
- Text Generation (LLM)
16+
- Text to Speech (TTS)
17+
- Speech to Text (STT)
18+
- Embedding
19+
- Lipsync
20+
- **Samples:** Samples use cases that implements the ai services
21+
- Digital Avatar
1522

1623
## Software Requirements
1724

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
/node_modules
2-
/out
1+
node_modules/
2+
dist/
3+
logs/
4+
*.log
5+
.DS_Store
Lines changed: 97 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,134 @@
1-
# Edge AI Studio - Electron App
1+
# Edge AI Studio - Electron Builder Version
22

3-
This directory contains the Electron application for Edge AI Studio.
3+
This directory contains the Electron Builder implementation of Edge AI Studio, running in parallel with the Electron Forge version for comparison and testing.
44

5-
## Development
5+
## Differences from Electron Forge
66

7-
### Prerequisites
7+
| Feature | Electron Forge | Electron Builder |
8+
|---------|---------------|------------------|
9+
| Configuration | `forge.config.js` | `build` in `package.json` |
10+
| Package Command | `electron-forge package` | `electron-builder --dir` |
11+
| Make Command | `electron-forge make` | `electron-builder` |
12+
| Dependencies | Multiple `@electron-forge/*` packages | Single `electron-builder` package |
813

9-
Before starting, ensure you have the following installed:
14+
## Setup
1015

11-
- **Node.js** and **npm**
16+
From the project root, run:
1217

13-
If you're behind a proxy, export the following environment variable before installing dependencies:
18+
```bash
19+
# Linux/macOS
20+
./setup.sh
1421

15-
For Linux/macOS:
22+
# Windows PowerShell
23+
./setup.ps1
24+
```
25+
26+
Or setup just this directory:
1627

1728
```bash
18-
export ELECTRON_GET_USE_PROXY=http://proxy:port
29+
# Linux/macOS
30+
cd electron-builder
31+
./setup.sh
32+
33+
# Windows PowerShell
34+
cd electron-builder
35+
./setup.ps1
1936
```
2037

21-
For Windows (PowerShell):
38+
## Development
39+
40+
### Start in Development Mode
2241

23-
```powershell
24-
$env:ELECTRON_GET_USE_PROXY="http://proxy:port"
42+
```bash
43+
cd electron-builder
44+
npm start
2545
```
2646

47+
This will launch the Electron app pointing to your local frontend server.
2748

28-
### Starting the Electron App
49+
## Building
2950

30-
To start the Electron app in development mode:
51+
### Build Package Directory (No Installer)
3152

3253
```bash
33-
npm run start
54+
cd electron-builder
55+
npm run build:dir
3456
```
3557

36-
### Packaging the Electron App
58+
This creates an unpacked directory at `../out/linux-unpacked/` (or `win-unpacked` on Windows).
3759

38-
To package the Electron app for distribution:
60+
### Build Distributable
3961

4062
```bash
41-
npm run make
42-
```
63+
# Linux
64+
npm run build:linux
4365

44-
**Note:** Before running `npm run make`, ensure that all dependencies are set up properly by running the package script:
66+
# Windows
67+
npm run build:win
4568

46-
```bash
47-
../scripts/package.sh
69+
# Both
70+
npm run build
4871
```
4972

50-
This script will help ensure all dependencies are installed and configured correctly before packaging.
73+
This creates distributable installers:
74+
- **Linux**: ZIP and DEB files
75+
- **Windows**: Squirrel installer
76+
77+
Output is in `../out/`.
78+
79+
## Configuration
80+
81+
The build configuration is in `package.json` under the `build` key. Key settings:
82+
83+
- **appId**: `com.intel.edge-ai-studio`
84+
- **productName**: `EdgeAIStudio`
85+
- **extraResources**: Copies `frontend`, `workers`, and `scripts` from `../build/`
86+
- **electronFuses**: Same security settings as Forge version
87+
- **Linux targets**: ZIP and DEB
88+
- **Windows targets**: Squirrel
5189

52-
## Running on Ubuntu 24.04
90+
## Package Script
5391

54-
If you're running the packaged Electron app on Ubuntu 24.04, you may need to adjust AppArmor settings to allow the application to run properly:
92+
To use the automated package script (similar to Forge):
5593

5694
```bash
57-
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
95+
cd ../scripts
96+
./package-builder.sh
5897
```
5998

60-
This command disables AppArmor restrictions on unprivileged user namespaces, which is required for Electron apps to function correctly on Ubuntu 24.04.
99+
This will:
100+
1. Create `../build/` directory
101+
2. Copy workers (excluding `.venv`, `__pycache__`, etc.)
102+
3. Copy scripts
103+
4. Build frontend
104+
5. Run `electron-builder`
105+
6. Create final ZIP package
106+
107+
## Comparing with Forge
108+
109+
Both versions are functionally identical. You can test both to compare:
110+
111+
1. **Build time**: Which is faster?
112+
2. **Package size**: Any difference in final output?
113+
3. **Ease of use**: Which configuration is clearer?
114+
4. **Features**: Any missing capabilities?
115+
116+
## Migration Status
61117

62-
## Project Structure
118+
**Completed**:
119+
- Package.json with build configuration
120+
- All source files (main.js, preload.js, splash files)
121+
- Setup scripts (Linux & Windows)
122+
- Electron Fuses configuration
123+
- Extra resources configuration
63124

64-
- `main.js` - Main Electron process
65-
- `preload.js` - Preload script for renderer process
66-
- `splash.html` - Splash screen HTML
67-
- `splash.js` - Splash screen JavaScript
68-
- `forge.config.js` - Electron Forge configuration
69-
- `logs/` - Application log files
125+
📋 **To Do**:
126+
- Create package script for automated builds
127+
- Test on Windows
128+
- Compare output with Forge version
70129

71-
## Prerequisites
130+
## Notes
72131

73-
Make sure you have Node.js and npm installed before running the commands above.
132+
- The `main.js` file is identical to the Forge version
133+
- Output directory is shared (`../out/`) but different subdirectories
134+
- Both versions can coexist without conflicts
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright (C) 2025 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses');
5+
const path = require('path');
6+
7+
exports.default = async function (context) {
8+
const { electronPlatformName, appOutDir } = context;
9+
10+
let electronBinaryPath;
11+
12+
if (electronPlatformName === 'darwin') {
13+
electronBinaryPath = path.join(
14+
appOutDir,
15+
`${context.packager.appInfo.productFilename}.app`,
16+
'Contents',
17+
'MacOS',
18+
context.packager.appInfo.productFilename
19+
);
20+
} else if (electronPlatformName === 'win32') {
21+
electronBinaryPath = path.join(
22+
appOutDir,
23+
`${context.packager.appInfo.productFilename}.exe`
24+
);
25+
} else {
26+
electronBinaryPath = path.join(
27+
appOutDir,
28+
context.packager.appInfo.productFilename
29+
);
30+
}
31+
32+
console.log('Flipping Electron fuses...');
33+
34+
await flipFuses(electronBinaryPath, {
35+
version: FuseVersion.V1,
36+
[FuseV1Options.RunAsNode]: false,
37+
[FuseV1Options.EnableCookieEncryption]: true,
38+
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
39+
[FuseV1Options.EnableNodeCliInspectArguments]: false,
40+
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
41+
[FuseV1Options.OnlyLoadAppFromAsar]: true,
42+
});
43+
44+
console.log('Fuses flipped successfully!');
45+
};

usecases/ai/edge-ai-studio/electron/forge.config.js

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)