Skip to content

Commit 4e588fd

Browse files
committed
update readme and changelog
1 parent 279b238 commit 4e588fd

File tree

4 files changed

+29
-59
lines changed

4 files changed

+29
-59
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
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.4 - 2023-05-08
5+
## 0.0.6 - 2023-05-11
6+
7+
### Changed
8+
- Combined submit_job and status check into a single function call.
9+
10+
## 0.0.5 - 2023-05-08
611

712
### Added
813
- SpeechToText service

README.md

Lines changed: 19 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,92 +16,56 @@ pip install slashml
1616

1717
```python
1818
from slashml import TextToSpeech
19-
import time
2019

21-
# Initialize model
22-
model = TextToSpeech()
23-
24-
service_provider = TextToSpeech.ServiceProvider.GOOGLE
25-
26-
# Submit speechification request
27-
job = model.speechify(text="To be or not to be, that is the question!", service_provider=service_provider)
28-
29-
assert job.status != "ERROR", f"{job}"
30-
print(f"Job ID: {job.id}")
20+
# Replace `API_KEY` with your SlasML API token. This example still runs without
21+
# the API token but usage will be limited
22+
model = TextToSpeech(api_key=None)
3123

32-
# check job status
33-
response = model.status(job.id, service_provider=service_provider)
24+
input_text = "to be or not to be, that is the question!"
3425

35-
while response.status == "IN_PROGRESS":
36-
time.sleep(5)
37-
response = model.status(job.id, service_provider=service_provider)
38-
print(f"Response = {response}. Retrying in 5 seconds")
26+
# Submit request
27+
job = model.execute(text=input_text, service_provider=TextToSpeech.ServiceProvider.AWS)
3928

40-
print(response)
29+
print (f"\n\n\n You can access the audio file here: {job.audio_url}")
4130
```
4231

4332
#### Transcribe an audio file
4433
<!-- write a code snippet in the minimum number of lines -->
4534

4635
```python
4736
from slashml import SpeechToText
48-
import time
49-
50-
# Initialize model
51-
model = SpeechToText()
52-
53-
service_provider = SpeechToText.ServiceProvider.WHISPER
54-
# Submit transcription request
55-
job = model.transcribe(upload_url="https://slashml.s3.ca-central-1.amazonaws.com/c7d38026-3ab4-4a04-ad9e-b6679ab79a87", service_provider=service_provider)
5637

57-
assert job.status != "ERROR", f"{job}"
58-
print(f"Job ID: {job.id}")
38+
# Replace `API_KEY` with your SlasML API token. This example still runs without
39+
# the API token but usage will be limited
40+
model = SpeechToText(api_key=None)
5941

60-
# check job status
61-
response = model.status(job.id, service_provider=service_provider)
42+
response = model.execute(
43+
upload_url='https://slashml.s3.ca-central-1.amazonaws.com/695c711f-9f5d-4ff1-ae4f-4439842eef5f',
44+
service_provider=SpeechToText.ServiceProvider.WHISPER
45+
)
6246

63-
while response.status == "IN_PROGRESS":
64-
time.sleep(5)
65-
response = model.status(job.id, service_provider=service_provider)
66-
print(f"Response = {response}. Retrying in 5 seconds")
47+
print(f"\n\n\n\nTranscription = {response.transcription_data.transcription}")
6748

68-
print(response)
6949
```
7050

7151
#### Summarize a text input
7252
<!-- write a code snippet in the minimum number of lines -->
7353

7454
```python
7555
from slashml import TextSummarization
76-
import time
7756

78-
# Initialize model
79-
model = TextSummarization()
80-
81-
service_provider = TextSummarization.ServiceProvider.OPENAI
82-
83-
# Submit summariztion request
84-
job = model.summarize(text="There are of course kinds of thinking that can be done without writing. If you don't need to go too deeply into a problem, you can solve it without writing. If you're thinking about how two pieces of machinery should fit together, writing about it probably won't help much. And when a problem can be described formally, you can sometimes solve it in your head. But if you need to solve a complicated, ill-defined problem, it will almost always help to write about it. Which in turn means that someone who's not good at writing will almost always be at a disadvantage in solving such problems.", service_provider=service_provider)
57+
model = TextSummarization(api_key=None)
8558

86-
assert job.status != "ERROR", f"{job}"
87-
print(f"Job ID: {job.id}")
59+
input_text = """A good writer doesn't just think, and then write down what he thought, as a sort of transcript. A good writer will almost always discover new things in the process of writing. And there is, as far as I know, no substitute for this kind of discovery. Talking about your ideas with other people is a good way to develop them. But even after doing this, you'll find you still discover new things when you sit down to write. There is a kind of thinking that can only be done by writing."""
8860

89-
# check job status
90-
response = model.status(job.id, service_provider=service_provider)
61+
response = model.execute(text=input_text, service_provider=TextSummarization.ServiceProvider.OPENAI)
9162

92-
while response.status == "IN_PROGRESS":
93-
time.sleep(5)
94-
response = model.status(job.id, service_provider=service_provider)
95-
print(f"Response = {response}. Retrying in 5 seconds")
63+
print(f"Summary = {response.summarization_data}")
9664

97-
print(response)
9865
```
9966

10067

101-
102-
10368
### View the list of service providers available
104-
10569
```python
10670
from slashml import TextToSpeech
10771

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# the API token but usage will be limited
55
API_KEY = "a7011983a0f3d64ee113317b1e36f8e5bf56c14a"
66

7-
service_provider_speech_to_text = SpeechToText.ServiceProvider.ASSEMBLY
7+
service_provider_speech_to_text = SpeechToText.ServiceProvider.WHISPER
88
service_provider_summarize = TextSummarization.ServiceProvider.OPENAI
9-
service_provider_text_to_speech = TextToSpeech.ServiceProvider.AWS
9+
service_provider_text_to_speech = TextToSpeech.ServiceProvider.GOOGLE
1010

1111
# 10 minute audio file already uploaded
1212
uploaded_url = (
@@ -22,6 +22,7 @@
2222
upload_url=uploaded_url, service_provider=service_provider_speech_to_text
2323
)
2424

25+
print('starting pipeline, the first response might take 10 secs')
2526
transcribed_text = response.transcription_data.transcription
2627
print (f"Transcribed Text = {transcribed_text}")
2728

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def read_req_file(req_type):
1414

1515
setup(
1616
name="slashml",
17-
version="0.0.5",
17+
version="0.0.6",
1818
url="https://slashml.com/",
1919
author="eff-kay",
2020
author_email="faiizan14@gmail.com",

0 commit comments

Comments
 (0)