--- title: Phonetics Mcp emoji: 👂 colorFrom: purple colorTo: indigo sdk: docker pinned: false tags: - building-mcp-track-creative --- # 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 ```