Example: Audio Transcription
Transcribe an audio clip with Sieve
In this example, we’ll walk through a simple use case of Sieve and learn how to:
- Call an existing Sieve function in Python using the Sieve Python package
- Make a call via the Sieve API and poll for results
Introduction
Audio transcription helps transcribe audio to spoken word, which can be useful for applications like captioning, accessibility, content analysis, and more. Let’s explore using an app that already exists on Sieve for this use case.
Using the Python client
Install the Sieve package and login
Create transcriber script
Create a new Python file named transcriber.py
with the following code:
This Python script:
- Initializes a Sieve typed audio object and passes a URL to it (you can also pass a local path)
- Gets a remote function by reference for audio transcription
- Synchronously executes that remote function using
.run()
- Prints out the transcription
Execute the code
Congrats, you just ran your first Sieve app! You should see something similar to this output in your terminal.
By following these steps, we converted audio content to text in just a few lines of code. Just like this app, there are plenty of production-ready apps you can reference in code here.
Using the HTTP API
You can also submit a job via the API by sending a POST request to the /v2/push
endpoint:
Upon successful submission, you’ll receive a response containing the job_id
and other details:
/v2/jobs/<your-job-id>
endpoint and check the status
field:
Your result should look something like:
The outputs
field contains a list of output files generated by the job. Each output is described by a type and a URL where the file can be downloaded.
Was this page helpful?