WhisperMode
An enum of the possible Whisper modes
Import
from VisionCraftAPI.enums import WhisperMode
Available attributes
TRANSCRIBE = "transcribe"
TRANSLATE = "translate"
Usage example
from VisionCraftAPI import VisionCraftClient
from VisionCraftAPI.enums import WhisperMode
async def main():
# Set your API key
api_key = "YOUR_API_KEY"
# Create a VisionCraftClient instance
client = VisionCraftClient(api_key=api_key)
# Translate an audio file
data = await client.whisper(
audio_file='https://example.com/audio.mp3',
task=WhisperMode.TRANSLATE
)
print(data.text) # Print the translated text
print(data.segments) # Print the segments (if any are available)
print(data.input_length_ms) # Print the input length in milliseconds (if available
if __name__ == '__main__':
import asyncio
asyncio.run(main())
Last updated