Welcome to the ai|coustics API Python Examples repository! This repository contains example scripts and tutorials on how to use the ai|coustics API with Python.
ai|coustics provides AI-driven speech enhancement to enriching media experiences and natural conversations. This repository provides sample code to help you quickly integrate the ai|coustics API into your Python applications.
- Python 3.10+
- An ai|coustics API key. You can get one by signing up on our developer portal.
- Clone the repository:
git clone https://github.com/ai-coustics/api-tutorials.git
cd api-tutorials
-
Create a virtual environment, activate it, and install the dependencies:
- Recommended: using the
poetry
(documentation) - Or by using the python
venv
module and therequirements.txt
file
- Recommended: using the
-
Create the
.env
file that would includeAPI_KEY
and optionally theWEBHOOK_SIGNATURE
values. Check the description of the environment values at the configs.py -
Review and run the examples. The upload.py and download.py are simple examples. The advanced.py is implementing the whole cycle: uploading, catching an update using webhook, and downloading an enhanced media file.
- The
.env
file has requiredAPI_KEY
and optionalWEBHOOK_SIGNATURE
variables values. - Every example file has the entry point in the bottom where you can set your values. For instance in the download.py you are required to set the
generated_name
variable value, as a generated name of a file is unique.
Advanced example: since the advanced.py is using the webhook, you should consider following:
- The address of a server, that is started when you run the advanced.py script, shold be made accessible on the internet. There are multimple options of how you can do this, but for testing you can consider such free services like ngrok. Such services let you expose your local address on the internet easily.
- At the entry point you can change the default values of the
webhook_server_host
andwebhook_server_port
variables, which are"localhost"
and8002
respectively. - To better understand where media files are comming from, review the mocks.py file and change the mock_get_media_queue_period variable's value.
You can find the full API documentation here.
This project is licensed under the MIT License.
For any questions, feel free to reach out to us at [email protected] or visit our website ai-coustics.com.