-
Notifications
You must be signed in to change notification settings - Fork 44
Enhance README and add Gradio web interface for Audio2Face-3D API client #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,50 +1,225 @@ | ||||||||||||||||||||||||||||||||||
| # Sample Application connecting to Audio2Face-3D NIM hosted on NVCF | ||||||||||||||||||||||||||||||||||
| # Audio2Face-3D NIM API Client | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| A sample Python application to showcase the Audio2Face-3D NIM hosted on NVIDIA Cloud Functions (NVCF). | ||||||||||||||||||||||||||||||||||
| A sample Python application to showcase the Audio2Face-3D NIM hosted on NVIDIA Cloud Functions (NVCF). This client demonstrates how to send audio files and receive facial animation blendshapes data using NVIDIA's Audio2Face-3D API. | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## Getting started | ||||||||||||||||||||||||||||||||||
| ## 📋 Table of Contents | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Start by creating a python venv using: | ||||||||||||||||||||||||||||||||||
| - [Features](#features) | ||||||||||||||||||||||||||||||||||
| - [Prerequisites](#prerequisites) | ||||||||||||||||||||||||||||||||||
| - [Installation](#installation) | ||||||||||||||||||||||||||||||||||
| - [Usage](#usage) | ||||||||||||||||||||||||||||||||||
| - [Command Line Interface](#command-line-interface) | ||||||||||||||||||||||||||||||||||
| - [Gradio Web Interface](#gradio-web-interface) | ||||||||||||||||||||||||||||||||||
| - [Configuration](#configuration) | ||||||||||||||||||||||||||||||||||
| - [Available Models](#available-models) | ||||||||||||||||||||||||||||||||||
| - [Sample Audio Files](#sample-audio-files) | ||||||||||||||||||||||||||||||||||
| - [Output](#output) | ||||||||||||||||||||||||||||||||||
| - [Project Structure](#project-structure) | ||||||||||||||||||||||||||||||||||
| - [License](#license) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## ✨ Features | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - **CLI Client**: Command-line interface for batch processing audio files | ||||||||||||||||||||||||||||||||||
| - **Web Interface**: Interactive Gradio-based web UI for real-time testing | ||||||||||||||||||||||||||||||||||
| - **Multiple Character Models**: Support for Mark, Claire, and James stylization models | ||||||||||||||||||||||||||||||||||
| - **Emotion Control**: Configurable emotion parameters for animation generation | ||||||||||||||||||||||||||||||||||
| - **Blendshape Output**: ARKit-compatible blendshape weights export | ||||||||||||||||||||||||||||||||||
| - **Audio Streaming**: Efficient gRPC-based audio streaming | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## 📦 Prerequisites | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| - Python 3.8+ | ||||||||||||||||||||||||||||||||||
| - NVIDIA API Key (from [NVIDIA API Catalog](https://build.nvidia.com/)) | ||||||||||||||||||||||||||||||||||
| - Function ID for the Audio2Face-3D API | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## 🚀 Installation | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### 1. Create a Virtual Environment | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||
| python3 -m venv .venv | ||||||||||||||||||||||||||||||||||
| source .venv/bin/activate | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Then install the required dependencies: | ||||||||||||||||||||||||||||||||||
| ### 2. Install Dependencies | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||
| pip3 install -r requirements | ||||||||||||||||||||||||||||||||||
| pip3 install ../../proto/sample_wheel/nvidia_ace-1.2.0-py3-none-any.whl | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Note: This wheel is compatible with Audio2Face-3D NIM 1.3 | ||||||||||||||||||||||||||||||||||
| > **Note**: The `nvidia_ace-1.2.0` wheel is compatible with Audio2Face-3D NIM 1.3 | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### Dependencies | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| | Package | Version | Purpose | | ||||||||||||||||||||||||||||||||||
| |---------|---------|---------| | ||||||||||||||||||||||||||||||||||
| | numpy | 1.26.4 | Numerical operations | | ||||||||||||||||||||||||||||||||||
| | scipy | 1.13.0 | Audio file I/O | | ||||||||||||||||||||||||||||||||||
| | grpcio | 1.72.0rc1 | gRPC communication | | ||||||||||||||||||||||||||||||||||
| | protobuf | 4.24.1 | Protocol buffers | | ||||||||||||||||||||||||||||||||||
| | PyYAML | 6.0.1 | Configuration parsing | | ||||||||||||||||||||||||||||||||||
| | pandas | 2.2.2 | Data manipulation | | ||||||||||||||||||||||||||||||||||
| | gradio | 6.0.1 | Web interface | | ||||||||||||||||||||||||||||||||||
| | opencv-python-headless | 4.12.0.88 | Image processing | | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## 💻 Usage | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### Command Line Interface | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Run the CLI client with the following command: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||
| python3 ./nim_a2f_3d_client.py <audio_file.wav> <config.yml> --apikey <API_KEY> --function-id <Function_ID> | ||||||||||||||||||||||||||||||||||
| python3 ./nim_a2f_3d_client.py <audio_file.wav> <config.yml> --apikey <API_KEY> --function-id <FUNCTION_ID> | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| By Default: | ||||||||||||||||||||||||||||||||||
| #### Example | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||
| python3 ./nim_a2f_3d_client.py ../../example_audio/Claire_neutral.wav config/config_claire.yml --apikey <API_KEY> --function-id <Function_ID> | ||||||||||||||||||||||||||||||||||
| python3 ./nim_a2f_3d_client.py \ | ||||||||||||||||||||||||||||||||||
| ../../example_audio/Claire_neutral.wav \ | ||||||||||||||||||||||||||||||||||
| config/config_claire.yml \ | ||||||||||||||||||||||||||||||||||
| --apikey nvapi-xxxxxxxxxxxx \ | ||||||||||||||||||||||||||||||||||
| --function-id 0961a6da-fb9e-4f2e-8491-247e5fd7bf8d | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| The scripts takes four mandatory parameters, an audio file at format PCM 16 bits, | ||||||||||||||||||||||||||||||||||
| a yaml configuration file for the emotions parameters, the API Key generated by API Catalogue, and the Function ID | ||||||||||||||||||||||||||||||||||
| used to access the API function. | ||||||||||||||||||||||||||||||||||
| #### Arguments | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| | Argument | Required | Description | | ||||||||||||||||||||||||||||||||||
| |----------|----------|-------------| | ||||||||||||||||||||||||||||||||||
| | `file` | ✅ | PCM 16-bit single channel audio file in WAV format | | ||||||||||||||||||||||||||||||||||
| | `config` | ✅ | YAML configuration file for inference parameters | | ||||||||||||||||||||||||||||||||||
| | `--apikey` | ✅ | NGC API Key from NVIDIA API Catalog | | ||||||||||||||||||||||||||||||||||
| | `--function-id` | ✅ | Function ID for the specific character model | | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### Gradio Web Interface | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Launch the interactive web interface: | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||||||||||||||
| python3 ./app.py | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| The web interface provides: | ||||||||||||||||||||||||||||||||||
| - Drag-and-drop audio upload | ||||||||||||||||||||||||||||||||||
| - Sample audio selection | ||||||||||||||||||||||||||||||||||
| - Real-time emotion parameter adjustment | ||||||||||||||||||||||||||||||||||
| - Visual blendshape output preview | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| - Visual blendshape output preview | |
| - Visual blendshape output preview | |
| - Visual blendshape animation preview video |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description "CSV export functionality" is misleading. Based on the code in app.py (lines 502-508), the web interface exports both CSV and JSON formats. Consider updating to:
- Downloadable animation data in JSON and CSV formats| - CSV export functionality | |
| - Downloadable animation data in JSON and CSV formats |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The blendshape parameters section states "The configuration supports ARKit-compatible blendshape multipliers and offsets" but doesn't provide any examples or explain what these parameters do. Consider adding a brief explanation:
The configuration supports ARKit-compatible blendshape multipliers and offsets:
- **Multipliers**: Scale the intensity of each blendshape (0.0 = disabled, 1.0 = full strength)
- **Offsets**: Add a constant bias to blendshape values (typically 0.0)
See [Apple ARKit documentation](https://developer.apple.com/documentation/arkit/arfaceanchor/blendshapelocation) for more details.| The configuration supports ARKit-compatible blendshape multipliers and offsets. See [Apple ARKit documentation](https://developer.apple.com/documentation/arkit/arfaceanchor/blendshapelocation) for more details. | |
| The configuration supports ARKit-compatible blendshape multipliers and offsets: | |
| - **Multipliers**: Scale the intensity of each blendshape (e.g., `0.0` = disabled, `1.0` = full strength) | |
| - **Offsets**: Add a constant bias to blendshape values (typically `0.0`) | |
| **Example:** | |
| ```json | |
| { | |
| "blendshapeMultipliers": { | |
| "jawOpen": 1.0, | |
| "eyeBlinkLeft": 0.8 | |
| }, | |
| "blendshapeOffsets": { | |
| "mouthSmileLeft": 0.1 | |
| } | |
| } |
See Apple ARKit documentation for more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The instructions for launching the web interface are incomplete. The app requires an API key to be set (hardcoded in the current implementation, but should be via environment variable). Add documentation about setting the API key before running:
Then launch the app:
Then launch the app: