Skip to content

Commit

Permalink
add {token} to argument in main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
RayNawfal committed Feb 27, 2024
1 parent 14e925d commit 9bff292
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
4 changes: 3 additions & 1 deletion python/audio2text-input/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ On the Linux terminal execute the following commands:

# Return transcript from AssemblyAI as output
~$ si instance output <Instance-id>
```
```

---
7 changes: 3 additions & 4 deletions python/audio2text-input/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -38,5 +38,4 @@ async def run(context, input, args1):
else:
time.sleep(3)


return Stream.read_from(f"{transcription_result['text']} \n")
return Stream.read_from(f"{transcription_result['text']} \n")
37 changes: 23 additions & 14 deletions python/audio2text-input/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
"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"
}
}

0 comments on commit 9bff292

Please sign in to comment.