31 lines
922 B
Python
31 lines
922 B
Python
from pathlib import Path
|
|
import runpod
|
|
from runpod.serverless import os
|
|
import loaders
|
|
|
|
access_token = os.environ.get("VERBANOTE_HF_TOKEN")
|
|
output_path = os.environ.get("VERBANOTE_OUTPUT_PATH", "/transcriptions")
|
|
output_path = str(Path(output_path))
|
|
input_path = os.environ.get("VERBANOTE_INPUT_PATH", "/audiofiles")
|
|
input_path = str(Path(input_path))
|
|
|
|
loaders.prep()
|
|
diarize_pipeline = loaders.diarization(access_token)
|
|
whisper_model = loaders.whisper()
|
|
|
|
|
|
def handler(job):
|
|
input = job["input"]
|
|
audiofile = loaders.audiofile(input.get("file"), path = input_path)
|
|
if not audiofile:
|
|
return {"error": "missing audio file location"}
|
|
|
|
return {
|
|
"speaker_timings": "s3-address-to-speakers",
|
|
"transcription_text": "s3-address-to-transcription",
|
|
"transcription_page": "web-address-to-deployment",
|
|
}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
runpod.serverless.start({"handler": handler})
|