Skip to content

Commit a967111

Browse files
authored
Merge pull request #37 from slashml/deepgram
Deepgram
2 parents 8094585 + 084b4b9 commit a967111

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
All notable changes to `slashml-python-client` aka `slashml` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## 0.0.7 - 2023-05-11
6+
7+
### Added
8+
- Added deepgram model for SpeechToText service
9+
10+
### Fixed
11+
- Fixed a bug in examples by replacing verbs with `submit_job`
12+
513
## 0.0.6 - 2023-05-11
614

715
### Changed

examples/speech_to_text_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def speech_to_text(audio_filepath, service_provider, api_key):
1212
print(f"file uploaded: {uploaded_file}")
1313

1414
# Submit transcription request
15-
job = model.transcribe(
15+
job = model.submit_job(
1616
uploaded_file["upload_url"], service_provider=service_provider
1717
)
1818

@@ -33,7 +33,7 @@ def speech_to_text(audio_filepath, service_provider, api_key):
3333
# Replace `API_KEY` with your SlasML API token. This example still runs without
3434
# the API token but usage will be limited
3535
API_KEY = None
36-
service_provider = SpeechToText.ServiceProvider.ASSEMBLY
36+
service_provider = SpeechToText.ServiceProvider.DEEPGRAM
3737
audio_filepath = "test.mp3"
3838

3939
# Find all the service providers that we support by running the choices() method

examples/speech_to_text_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Replace `API_KEY` with your SlasML API token. This example still runs without
44
# the API token but usage will be limited
55
API_KEY = None
6-
service_provider = SpeechToText.ServiceProvider.AWS
6+
service_provider = SpeechToText.ServiceProvider.DEEPGRAM
77
audio_filepath = "test.mp3"
88

99
# Find all the service providers that we support by running the choices() method

examples/summarize_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def summarize(text, service_provider, api_key):
66
model = TextSummarization(api_key=api_key)
77

88
# Submit request
9-
job = model.summarize(text=text, service_provider=service_provider)
9+
job = model.submit_job(text=text, service_provider=service_provider)
1010

1111
assert job.status != "ERROR", f"{job}"
1212
print(f"Job ID: {job.id}")
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from slashml import TextToSpeech
2+
import time
23

34
# Replace `API_KEY` with your SlasML API token. This example still runs without
45
# the API token but usage will be limited
@@ -13,7 +14,15 @@
1314
model = TextToSpeech(api_key=API_KEY)
1415

1516
# Submit request
16-
job = model.speechify(text=input_text, service_provider=service_provider)
17+
job = model.submit_job(text=input_text, service_provider=service_provider)
1718
print(job)
1819

19-
print (f"\nYou can access the audio file here: {job.audio_url}")
20+
# check job status
21+
response = model.status(job.id, service_provider=service_provider)
22+
23+
while response.status == "IN_PROGRESS":
24+
print(f"Response = {response}. Retrying in 30 seconds")
25+
time.sleep(30)
26+
response = model.status(job.id, service_provider=service_provider)
27+
28+
print (f"\nYou can access the audio file here: {response.audio_url}")

slashml/speech_to_text.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class ServiceProvider(Enum):
99
ASSEMBLY = "assembly"
1010
AWS = "aws"
1111
WHISPER = "whisper"
12+
DEEPGRAM = 'deepgram'
1213

1314
@classmethod
1415
def choices(cls):
@@ -55,10 +56,10 @@ def execute(self, upload_url: str, service_provider: ServiceProvider):
5556
# check job status
5657
response = getTaskStatus(self._base_url, self._headers, job.id, service_provider)
5758

58-
while response.status == "IN_PROGRESS":
59-
time.sleep(5)
60-
response = getTaskStatus(self._base_url, self._headers, job.id, service_provider)
61-
print(f"Response = {response}. Retrying in 5 seconds")
59+
# while response.status == "IN_PROGRESS":
60+
time.sleep(5)
61+
response = getTaskStatus(self._base_url, self._headers, job.id, service_provider)
62+
print(f"Response = {response}. Retrying in 5 seconds")
6263

6364
return response
6465

0 commit comments

Comments
 (0)