Spaces:
Sleeping
Sleeping
File size: 2,294 Bytes
b775d7c e9e7c9c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | ---
title: Phonetics Mcp
emoji: 🚀
colorFrom: purple
colorTo: indigo
sdk: docker
pinned: false
---
# Phonetics MCP
This is a Gradio application that provides two tools for working with phonetics:
1. **Text to Phonetics:** Converts a given text into a dictionary of possible phonetic pronunciations and their probabilities.
2. **Phonetics to Text:** Converts an International Phonetic Alphabet (IPA) expression into a list of possible dictations.
## MCP Tools
This application is designed to be used as a Model-centric Programming (MCP) service on Hugging Face Spaces. The following tools are available:
### `text_to_phonetics`
This tool takes a string of text and a language code and returns a dictionary of possible phonetic pronunciations and their probabilities.
**Inputs:**
* `text` (string): The text to convert.
* `language` (string): The 2-letter language code of the text (e.g., 'en' for English).
**Output:**
* `pronunciations` (dict): A dictionary where keys are phonetic pronunciations and values are their probabilities.
**Example:**
```json
{
"text": "hello",
"language": "en"
}
```
```json
{
"hello": 0.99,
"hel": 0.01
}
```
### `phonetics_to_text`
This tool takes an International Phonetic Alphabet (IPA) expression and a language and returns a list of all possible dictations of it in that language.
**Inputs:**
* `ipa` (string): The IPA expression to convert.
* `language` (string): The 2-letter language code of the expression (e.g., 'en' for English).
**Output:**
* `dictations` (list): A list of possible dictations.
**Example:**
```json
{
"ipa": "həˈloʊ",
"language": "en"
}
```
```json
[
"dictation one",
"dictation two"
]
```
## Development
This project is set up to be run as a Docker container.
**Running the Application:**
The `Dockerfile` specifies the command to run the application using `uvicorn`:
```bash
uvicorn app:app --host 0.0.0.0 --port 7860
```
This command starts the Uvicorn server, which serves the Gradio application defined in `app.py`.
**Dependencies:**
Project dependencies are managed in the `pyproject.toml` file and installed using `uv`. The main dependencies are:
* `gradio`
* `litellm`
To install dependencies, you can use the following command:
```bash
uv sync --dev
``` |