Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions microservices/audio-analyzer/docs/user-guide/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,32 @@ Refer to [supported models](./Overview.md#models-supported) for the list of mode

# Quick Start

User has following different options to start and use the application :
User has following different options to setup/build and use the application.

- [Build the image and run using Docker script](./how-to-build-from-source.md#build-and-run-using-docker-script). Docker script helps build images for application and any required dependency and deploy the application. Default storage backend used here is `minio` but can be updated to use `local` storage backend.
- [Use pre-built image for standalone setup](#standalone-setup-in-docker-container). Standalone setup has no external dependency. Default and recommended storage backend: `local`.
- [Build and setup on host using setup script](./how-to-build-from-source.md#setup-and-run-on-host-using-setup-script). Only storage backend available: `local`
- [Build and setup on host manually](#manual-host-setup-using-poetry). Default storage backend used is `local` but can be configured to use `minio` storage backend.
### Recommended Setup
- [Use pre-built image for standalone setup](#standalone-setup-in-docker-container). Standalone setup has no external dependency. Storage backend used: `local`.
- [Build and run on host using setup script](./how-to-build-from-source.md#build-and-run-on-host-using-setup-script). Storage backend used: `local`

### Advanced Setup

> __**NOTE :**__ Audio-Analyzer microservice can also be run with Minio as its storage backend. However, this is not a recommended setup and is only meant for advanced users. This setup requires familiarity with using Minio and using non-documented API requests.

- [Build and run in container using Docker script](./how-to-build-from-source.md#build-and-run-in-container-using-docker-script). Docker script helps build images for application and deploy the application with any optional dependency. Default storage backend used here is `minio` but can be updated to use `local` storage backend. If `minio` storage backend is used, then the script also brings up Minio server container along with application container.
- [Build and run on host manually](#build-and-run-on-host-manually). Default storage backend used is `local` but can be configured to use `minio` storage backend.


## Standalone Setup in Docker Container

1. Set the registry and tag for the public image to be pulled.

```bash
export REGISTRY=intel/
export TAG=latest
export PUB_REGISTRY=intel/
export PUB_TAG=latest
```
2. Pull public image for Audio Analyzer Microservice:

```bash
docker pull ${REGISTRY}audio-analyzer:${TAG:-latest}
docker pull ${PUB_REGISTRY}audio-analyzer:${PUB_TAG:-latest}
```
3. Set the required environment variables:

Expand All @@ -124,7 +130,7 @@ User has following different options to start and use the application :

```bash
# Run Audio Analyzer application container exposed on a randomly assigned port
docker run --rm -d -P -v $AUDIO_ANALYZER_DIR:/data -e http_proxy -e https_proxy -e ENABLED_WHISPER_MODELS -e DEFAULT_WHISPER_MODEL --name audioanalyzer intel/audio-analyzer:latest
docker run --rm -d -P -v $AUDIO_ANALYZER_DIR:/data -e http_proxy -e https_proxy -e ENABLED_WHISPER_MODELS -e DEFAULT_WHISPER_MODEL --name audioanalyzer ${PUB_REGISTRY}audio-analyzer:${PUB_TAG:-latest}
```

7. Access the Audio-Analyzer API in a web browser on the URL given by this command:
Expand All @@ -135,23 +141,23 @@ User has following different options to start and use the application :
echo http://${host}:${port}/docs
```

## API Usage
### API Usage

Below are examples of how to use the API on command line with `curl`.

### Health Check
#### Health Check

```bash
curl "http://localhost:$port/api/v1/health"
```

### Get Available Models
#### Get Available Models

```bash
curl "http://localhost:$port/api/v1/models"
```

### Filesystem Storage Examples
#### Filesystem Storage Examples

#### Upload a Video File for Transcription

Expand All @@ -172,7 +178,7 @@ Once the transcription process is completed, the transcript files will be availa
ls $AUDIO_ANALYZER_DIR/transcript
```

## Transcription Performance and Optimization on CPU
### Transcription Performance and Optimization on CPU

The service uses **pywhispercpp** with the following optimizations for CPU transcription:

Expand All @@ -181,7 +187,7 @@ The service uses **pywhispercpp** with the following optimizations for CPU trans
- **Greedy Decoding**: Faster inference by using greedy decoding instead of beam search
- **OpenVINO IR Models**: Can download and use OpenVINO IR models for even faster CPU inference

# Manual Host Setup using Poetry
## Build and run on host manually

> **__NOTE :__** This is an advanced setup and is recommended for development/contribution only. As an alternative method to setup on host, please see : [setting up on host using setup script](./how-to-build-from-source.md#setup-and-run-on-host-using-setup-script). When setting up on host, the default storage backend would be local filesystem. Please make sure `STORAGE_BACKEND` is not overridden to **minio**, unless you want to explicitly use the Minio backend.

Expand Down Expand Up @@ -238,7 +244,7 @@ The service uses **pywhispercpp** with the following optimizations for CPU trans
STORAGE_BACKEND=minio DEBUG=True poetry run uvicorn audio_analyzer.main:app --host 0.0.0.0 --port 8000 --reload
```

## Running Tests
### Running tests for host setup

We can run unit tests and generate coverage by running following command in the application's directory (microservices/audio-analyzer) in the cloned repo:

Expand All @@ -255,15 +261,15 @@ poetry run coverage run -m pytest ./tests
poetry run coverage report -m
```

## API Documentation
### API Documentation

When running the service, you can access the Swagger UI documentation at:

```bash
http://localhost:8000/docs
```

## Advanced Setup Options
## More Advanced Setup Options

### Manually Running a Local MinIO Server

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Following options are provided to build the microservice.
- [Build and run application with required dependencies using Docker Script](#build-and-run-using-docker-script).
- [Build and run on host using Setup Script](#setup-and-run-on-host-using-setup-script).

## Build and Run using Docker Script
## Build and run in container using Docker script

1. Clone the repository:
```bash
Expand Down Expand Up @@ -86,6 +86,8 @@ Following options are provided to build the microservice.
./setup_docker.sh
```

4. If above step is successful, it will print the complete URL of API endpoint along with URL of Swagger API docs. Please refer the API docs to learn how to send request to Audio-Analyzer when running with Minio.

### Docker Setup Options

The `setup_docker.sh` script when run without any parameters builds and runs the production docker images. It additionally supports the following options:
Expand Down Expand Up @@ -117,7 +119,8 @@ The production environment uses:
- Optimized container without development dependencies
- No source code mounting (code is copied at build time)

## Setup and run on host using Setup Script

## Build and run on host using Setup Script

1. Clone the repository:
```bash
Expand Down
2 changes: 1 addition & 1 deletion microservices/audio-analyzer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pydantic = "^2.11.5"
pydantic-settings = "^2.9.1"
setuptools = "^80.9.0"
transformers = "^4.51.3"
pywhispercpp = { git = "https://github.com/absadiki/pywhispercpp.git" }
pywhispercpp = { git = "https://github.com/absadiki/pywhispercpp.git", tag = "v1.4.0" }
moviepy = "^2.1.2"
aiofiles = "^23.2.1"
optimum-intel = "^1.24.0"
Expand Down
Loading