Skip to content

Latest commit

 

History

History

README.md

Local AI

This example shows how to build a small Avalonia desktop application that embeds DotNetBrowser and runs a local browser-based AI feature with Transformers.js.

Prerequisites

Project structure

  • MainWindow.axaml declares the app layout and the BrowserView control that displays the browser content.
  • MainWindow.axaml.cs creates the Chromium engine and loads the local app URL.
  • LocalAppSchemeHandler.cs serves bundled files from the web/ directory.
  • web/index.html contains the web app UI.
  • web/app.js loads the local model and handles user actions.
  • web/styles.css styles the web app UI.

Set the license key

Open MainWindow.axaml.cs and set your license key:

engine = EngineFactory.Create(new EngineOptions.Builder
{
    LicenseKey = "<your_license_key>",
    ...
}.Build());

Run the example

From this directory:

dotnet run

Or open LocalAiAssistant.sln in your IDE and run the LocalAiAssistant project.

When the window opens, wait for the model to load. Then type some text into the input field and click one of the actions. The app runs the model locally and shows the generated result in the same window.