A template project combining Tauri, Python (TensorFlow), FastAPI, and Svelte to create lightweight desktop applications with integrated machine learning capabilities.
hey-api
.š tauri-tensorflow-template
āāā š server # Python TensorFlow + FastAPI backend
āāā š src # Svelte frontend
āāā š src-tauri # Rust-based Tauri application
āāā š README.md # Documentation
To enable GPU capabilities for TensorFlow, you must install the following NVIDIA components and add their paths to the system environment variables: Maybe try with only 12.6 and cudnn 9.6 first and if it doesn't work try with 11.8 and cudnn 8.9
PATH
After installation, ensure the following directories are added to your system's PATH
environment variable:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\8.9.7\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.4\bin
C:\Program Files\NVIDIA\CUDNN\v9.6\bin
git clone https://github.com/ydubrana/tauri-tensorflow-template.git
cd tauri-tensorflow-template
Use Conda to create the required environment from the environment.yml
file:
cd server
conda create --file environment.yml
conda activate tauri-tensorflow
To confirm the installation:
Open a terminal and run:
nvcc --version
This will display the version of CUDA installed.
Check that TensorFlow detects the GPU:
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
Use the provided PowerShell script to bundle the server into an executable using PyInstaller:
pnpm run build-server
This will generate the server executable along with the required Python runtime.
Navigate to the frontend
directory and install the required packages:
cd frontend
pnpm install
Start the backend server and build the API client for the frontend:
pnpm run launch-server
pnpm run build-server-client
Start the Tauri application in development mode:
pnpm run tauri dev
The backend server will automatically start and stop with the Tauri application.
Interact with the TensorFlow model via the Svelte-based UI.
To package the application for distribution, i have created a github actions that will build the application for windows. This is compatible with Tauri updater and public realease in private repository. Feel free to open an issue if you want to know more about it.
This project is licensed under the MIT License.