Skip to content

Commit

Permalink
introduce submit and transcribe methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Dec 4, 2023
1 parent 3e6f55f commit 05010ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions sample-app/src/main/java/sample/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public static void main(String... args) throws IOException {
UploadedFile uploadedFile = aai.files().upload(Files.readAllBytes(file.toPath()));
System.out.println("Uploaded file" + uploadedFile);

transcript = aai.transcript().create(TranscriptParams.builder()
transcript = aai.transcript().transcribe(TranscriptParams.builder()
.audioUrl("https://storage.googleapis.com/aai-docs-samples/nbc.mp3")
.build(), true);
.build());
System.out.println("Created and polled transcript " + transcript);

transcript = aai.transcript().create(TranscriptParams.builder()
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/assemblyai/api/PollingTranscriptClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ public PollingTranscriptClient(ClientOptions clientOptions, Transcriber transcri
this.transcriber = transcriber;
}

/**
* Create a transcript from an audio or video file that is accessible via a URL.
*/
public Transcript create(TranscriptParams request, boolean poll) {
return transcriber.transcribe(request.getAudioUrl(), request, poll);
public Transcript submit(TranscriptParams request) {
return transcriber.transcribe(request.getAudioUrl(), request, false);
}

public Transcript transcribe(TranscriptParams request) {
return transcriber.transcribe(request.getAudioUrl(), request, true);
}

}

0 comments on commit 05010ce

Please sign in to comment.