-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a8a280
commit d527fd2
Showing
5 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Audio2text Input | ||
|
||
This is another version which uses input channel instead of filesystem | ||
|
||
The audio file | ||
<a href="https://salford.figshare.com/collections/HARVARD_speech_corpus_-_audio_recording_2019/4437578" target="_blank">`song.wav`</a> is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
|
||
___ | ||
|
||
## Description | ||
|
||
This is a sequence which transript audio file using AssemblyAi API. | ||
|
||
## Prerequisites | ||
|
||
> ❗ Remember to [setup transform-hub locally](https://docs.scramjet.org/platform/self-hosted-installation) or use the [platform's environment](https://docs.scramjet.org/platform/quick-start) for the sequence deployment. | ||
As this apps is using AssemblyAi Api, the key is required to use it. For informations how to get one please refer to [assemblyAi](https://www.assemblyai.com/) | ||
|
||
## Running | ||
|
||
Open the terminal and run the following commands: | ||
|
||
```bash | ||
# go to 'repo-checker' directory | ||
cd typescript/audio2text-input | ||
|
||
# install dependencies | ||
npm install | ||
|
||
# transpile TS->JS to dist/ | ||
npm run build | ||
|
||
# Pack the Sequence into a gzip format | ||
si seq pack dist | ||
|
||
# Send the Sequence to the Transform-Hub, with a return <Sequence-id> value | ||
si seq send dist.tar.gz | ||
|
||
# Start a Sequence, with the AssemblyAi-key as an argument parameter | ||
si seq start <Sequence-id> --args [\"<AssemblyAI-token>\"] | ||
|
||
# upload file to a instance | ||
si inst input - /path/to/your/file -e -t application/octet-stream | ||
|
||
``` | ||
|
||
## Getting results | ||
|
||
All the informations generated by this instance will be available at the log channel. | ||
|
||
To get result simply type in console: | ||
|
||
`si inst output - ` | ||
|
||
## Testing | ||
|
||
to make testing easier the sequence contains file ready to be uploaded. | ||
|
||
Logs when running this sequence with a sample file should look like this: | ||
|
||
![screenshot](https://github.com/scramjetorg/platform-samples/assets/53794300/1184b241-b11f-4b5a-b169-94b21ffcd44a) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "assembly", | ||
"version": "1.0.0", | ||
"description": "Sequence that uses AssemblyAi to transcript Audio sent by input channel", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "tsc -p tsconfig.json", | ||
"postbuild": "cp -r package.json dist/ && (cd dist && npm i --omit=dev)" | ||
}, | ||
"keywords": [ | ||
"Ai", | ||
"Stream", | ||
"AssemblyAi" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/scramjetorg/platform-samples/tree/main/typescript/audio2text" | ||
}, | ||
"author": "Piotr", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@scramjet/obj-logger": "^0.34.3", | ||
"@scramjet/utility": "^0.33.5", | ||
"axios": "^1.3.6", | ||
"date-and-time": "^2.4.3" | ||
}, | ||
"devDependencies": { | ||
"@scramjet/types": "0.33.5", | ||
"@types/node": "^20.2.5" | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ReadableApp } from "@scramjet/types"; | ||
import { Assembly } from "../../audio2text/src/utils/assembly"; | ||
import { Readable } from "stream"; | ||
|
||
const app: ReadableApp<any> = async function(input: Readable, apiKey: string) { | ||
const assembly = new Assembly(apiKey); | ||
|
||
assembly.logger.outputLogStream.pipe(this.logger.inputLogStream); | ||
|
||
return assembly.processFile(input).then(res => { | ||
this.logger.info("Result", res); | ||
|
||
return res; | ||
}); | ||
}; | ||
|
||
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": [ "ESNext" ], | ||
"target": "ESNext", | ||
"module": "CommonJS", | ||
"outDir": "./dist", | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"resolveJsonModule": true, | ||
} | ||
} |