transcription_api.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
    def store_audio(self, request):
        # Our SDK has many different components 
        # to help you build quickly and correctly.
        blob_storage = BlobStorage()

        # Get the audio file from the request
        audio_file = request.files.get('audio')
        if not audio_file:
            return {"error": "No audio file provided"}, 400

        # Generate a unique file ID
        file_id = str(uuid.uuid4())

        # Store the audio data in BlobStorage
        blob_storage.create(file_id, audio_file.read())

        return {
            "message": "Audio received and stored successfully",
            "file_id": file_id
        }, 200