Summarization
Using the VoiceAI platform, you can directly generate an abstractive summary of the transcript. This can be useful especially when the audios are very long. For example, summary of customer calls, meetings or legal proceedings can give context without the need for going through the whole transcript. Another use case could be generating descriptions for YouTube videos or for podcasts.
File Transcription Job with Summarization
- API
- Python SDK
Copy and paste the below curl request on your terminal to start a transcription using the API. Fill the variables with the appropriate values, as mentioned in the overview.
curl --location 'https://voice.neuralspace.ai/api/v2/jobs' \
--header 'Authorization: {{API_KEY}}' \
--form 'files=@"{{LOCAL_AUDIO_FILE_PATH}}"' \
--form 'config="{\"file_transcription\":{\"language_id\":\"{{LANG}}\", \"mode\":\"{{MODE}}\"},
\"summarize\":true}"'
In the above request, summarize
is an extra configuration that is being passed. It also returns a response similar to the regular file transcription API as seen in overview.
{
"success": true,
"message": "Job created successfully",
"data": {
"jobId": "281f8662-cdc3-4c76-82d0-e7d14af52c46"
}
}
Once installation steps for the package are complete, execute the below mentioned python code snippet:
import neuralspace as ns
vai = ns.VoiceAI()
# or,
# vai = ns.VoiceAI(api_key='YOUR_API_KEY')
# Setup job configuration
config = {
"file_transcription": {
"language_id": "en",
"mode": "advanced",
},
"summarize": True
}
# Create a new file transcription job
job_id = vai.transcribe(file='path/to/audio.wav', config=config)
print(job_id)
Here, the summarize
config is in addition to those mentioned in the overview page. The response looks similar as well:
6abe4f35-8220-4981-95c7-3b040d9b86d1
Fetch Transcription and Summarization Results
- API
- Python SDK
When you pass the jobId
(received in response to the transcription API) to the API below, it fetches the status and results of the job.
- If you have selected the translation feature while creating the job, you will also receive the translated summaries in all the mentioned target languages. These translated summaries are unavailable when translation is not enabled.
curl --location 'https://voice.neuralspace.ai/api/v2/jobs/{{jobId}}' \
--header 'Authorization: {{API_KEY}}'
Using the jobId
(received in response to the transcription API) the snippet below can be executed to fetch the status and results of the job.
result = vai.get_job_status(jobId)
print(result)
The response of the request above appears as follows:
{
...
"data": {
...
"result": {
...
"transcription": {
...
"summary": "Summary: The speakers have been searching in a library for something useful but haven't found anything..."
},
...
"translation": {
"hi": {
...
"summary": "सारांश: वक्ता पुस्तकालय में कुछ उपयोगी खोज रहे हैं लेकिन उन्हें कुछ नहीं मिला। ..."
},
"ar": {
...
"summary": "ملخص: لقد بحث المتحدثون في المكتبة عن شيء مفيد ولكنهم لم يعثروا على أي شيء. ..."
}
...
}
}
}
In the response above, the summary for the whole transcript is obtained. The summary for the translated transcript is also obtained like so if translation is enabled.
- If you have selected the translation feature while creating the job, you will also receive the translated summaries in all the mentioned target languages. These translated summaries are unavailable when translation is not enabled.
Troubleshooting and FAQ
Not able to proceed? Check out our FAQ page. If you still need help, feel free to reach out to us directly at support@neuralspace.ai or join our Slack community.