# HuggingFaceTextToSpeechModelInference

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/tools/audio/huggingface_text_to_speech_inference/HuggingFaceTextToSpeechModelInference)

HuggingFace Text-to-Speech Model Inference.

## Signature

```python
HuggingFaceTextToSpeechModelInference(
    self,
    model: str,
    file_extension: str,
    *,
    destination_dir: str = './tts',
    file_naming_func: Literal['uuid', 'timestamp'] = 'uuid',
    huggingface_api_key: Optional[SecretStr] = None,
    _HUGGINGFACE_API_KEY_ENV_NAME: str = 'HUGGINGFACE_API_KEY',
    _HUGGINGFACE_API_URL_ROOT: str = 'https://api-inference.huggingface.co/models',
)
```

## Description

**Requirements:**

- Environment variable ``HUGGINGFACE_API_KEY`` must be set,
or passed as a named parameter to the constructor.

## Extends

- `BaseTool`

## Constructors

```python
__init__(
    self,
    model: str,
    file_extension: str,
    *,
    destination_dir: str = './tts',
    file_naming_func: Literal['uuid', 'timestamp'] = 'uuid',
    huggingface_api_key: Optional[SecretStr] = None,
    _HUGGINGFACE_API_KEY_ENV_NAME: str = 'HUGGINGFACE_API_KEY',
    _HUGGINGFACE_API_URL_ROOT: str = 'https://api-inference.huggingface.co/models',
) -> None
```

| Name | Type |
|------|------|
| `model` | `str` |
| `file_extension` | `str` |
| `destination_dir` | `str` |
| `file_naming_func` | `Literal['uuid', 'timestamp']` |
| `huggingface_api_key` | `Optional[SecretStr]` |
| `_HUGGINGFACE_API_KEY_ENV_NAME` | `str` |
| `_HUGGINGFACE_API_URL_ROOT` | `str` |


## Properties

- `name`
- `description`
- `model`
- `file_extension`
- `destination_dir`
- `file_namer`
- `api_url`
- `huggingface_api_key`

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/tools/audio/huggingface_text_to_speech_inference.py#L15)