From 9bff2924dae82f69ffe476deeeaf4f7e4c7fb20a Mon Sep 17 00:00:00 2001 From: rnawfal Date: Tue, 27 Feb 2024 12:04:33 +0000 Subject: [PATCH] add {token} to argument in main.py --- python/audio2text-input/README.md | 4 ++- python/audio2text-input/main.py | 7 +++--- python/audio2text-input/package.json | 37 +++++++++++++++++----------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/python/audio2text-input/README.md b/python/audio2text-input/README.md index 4f07830..051df18 100644 --- a/python/audio2text-input/README.md +++ b/python/audio2text-input/README.md @@ -43,4 +43,6 @@ On the Linux terminal execute the following commands: # Return transcript from AssemblyAI as output ~$ si instance output -``` \ No newline at end of file +``` + +--- \ No newline at end of file diff --git a/python/audio2text-input/main.py b/python/audio2text-input/main.py index ce5e854..4720d77 100644 --- a/python/audio2text-input/main.py +++ b/python/audio2text-input/main.py @@ -3,12 +3,12 @@ from scramjet.streams import Stream import json -async def run(context, input, args1): +async def run(context, input, token): audio_file = await input.reduce(lambda a, b: a+b) base_url = "https://api.assemblyai.com/v2" headers = { - "authorization": args1 + "authorization": token } response = requests.post( @@ -38,5 +38,4 @@ async def run(context, input, args1): else: time.sleep(3) - - return Stream.read_from(f"{transcription_result['text']} \n") \ No newline at end of file + return Stream.read_from(f"{transcription_result['text']} \n") diff --git a/python/audio2text-input/package.json b/python/audio2text-input/package.json index 6954b73..e1e3520 100644 --- a/python/audio2text-input/package.json +++ b/python/audio2text-input/package.json @@ -1,15 +1,24 @@ { - "name": "py-transcript", - "version": "1.0.0", - "main": "./main.py", - "author": "Ray_Nawfal", - "license": "GPL-3.0", - "description": "Transcript audio file using AssemblyAI API.", - "engines": { - "python3": "3.8.0" - }, - "scripts": { - "build": "mkdir -p dist/__pypackages__/ && pip3 install -t dist/__pypackages__/ -r requirements.txt && cp -t ./dist/ *.py *.json *.wav", - "clean": "rm -rf ./dist" - } -} \ No newline at end of file + "name": "audio2text_py", + "version": "1.0.0", + "main": "./main.py", + "author": "Ray_Nawfal", + "license": "GPL-3.0", + "description": "Transcription of an audio file using AssemblyAI API.", + "keywords": [ + "AudioToText", + "Transcription", + "AssemblyAI" + ], + "repository": { + "type": "git", + "url": "https://github.com/scramjetorg/platform-samples/tree/main/python/audio2text-input" + }, + "engines": { + "python3": "3.8.0" + }, + "scripts": { + "build": "mkdir -p dist/__pypackages__/ && pip3 install -t dist/__pypackages__/ -r requirements.txt && cp -t ./dist/ *.py *.json *.wav", + "clean": "rm -rf ./dist" + } +}