Skip to content

Latest commit

 

History

History
 
 

speech-recognition-with-huggingface

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Speech Recognition with Hugging Face

This function uses the Hugging Face API to perform speech recognition. It takes an audio file from Appwrite storage and sends it to the Hugging Face API for speech recognition. The API returns the text and records it in the database. This function also supports receiving document events from the Appwrite Database.

🧰 Usage

POST /

Parameters

Name Description Location Type Sample Value
fileId Appwrite File ID of audio file Body String 65c6319c5f34dc9638ec

This function also accepts body of a file event from Appwrite Storage.

Response

Sample 200 Response:

Text from the audio file is recognized and stored in the database.

{
  "text": " going along slushy country roads and speaking to damp audiences in draughty schoolrooms day after day for a fortnight he'll have to put in an appearance at some place of worship on sunday morning and he can come to us immediately afterwards"
}

Sample 404 Response:

{
  "error": "File not found"
}

⚙️ Configuration

Setting Value
Runtime Node (18.0)
Entrypoint src/main.js
Build Commands npm install && npm run setup
Permissions any
Timeout (Seconds) 15
Events buckets.*.files.*.create

🔒 Environment Variables

APPWRITE_API_KEY

Your Appwrite project's API key.

Question Answer
Required Yes
Sample Value 083d341ee48...
Documentation Appwrite: Create an API key

This key should have all permissions in the Databases scope aswell as all permissions in the Storage scope.

APPWRITE_ENDPOINT

The endpoint where your Appwrite server is located. If not provided, it defaults to the Appwrite Cloud server: https://cloud.appwrite.io/v1.

Question Answer
Required No
Sample Value https://cloud.appwrite.io/v1

APPWRITE_BUCKET_ID

The ID of the bucket where audio is stored.

Question Answer
Required No
Sample Value speech_recogition

APPWRITE_DATABASE_ID

The ID of the database where the responses are stored.

Question Answer
Required No
Sample Value ai

APPWRITE_COLLECTION_ID

The ID of the collection where the responses are stored.

Question Answer
Required No
Sample Value speech_recogition

HUGGINGFACE_ACCESS_TOKEN

Secret for sending requests to the Hugging Face API.

Question Answer
Required Yes
Sample Value hf_x2a...
Documentation Hugging Face: API tokens