@@ -11,18 +11,20 @@ pip install slashml
1111
1212# Quickstart
1313
14- #### Transcribe an audio file
14+ #### Convert text to audio
1515<!-- write a code snippet in the minimum number of lines -->
1616
1717``` python
18- from slashml import SpeechToText
18+ from slashml import TextToSpeech
19+ import time
1920
2021# Initialize model
21- model = SpeechToText ()
22+ model = TextToSpeech ()
2223
23- service_provider = SpeechToText.ServiceProvider.ASSEMBLY
24- # Submit transcription request
25- job = model.transcribe(upload_url = " https://slashml.s3.ca-central-1.amazonaws.com/c7d38026-3ab4-4a04-ad9e-b6679ab79a87" , service_provider = service_provider)
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)
2628
2729assert job.status != " ERROR" , f " { job} "
2830print (f " Job ID: { job.id} " )
@@ -35,22 +37,22 @@ while response.status == "IN_PROGRESS":
3537 response = model.status(job.id, service_provider = service_provider)
3638 print (f " Response = { response} . Retrying in 30 seconds " )
3739
38- return response
40+ print ( response)
3941```
4042
41- #### Summarize a text input
43+ #### Transcribe an audio file
4244<!-- write a code snippet in the minimum number of lines -->
4345
4446``` python
45- from slashml import TextSummarization
47+ from slashml import SpeechToText
48+ import time
4649
4750# Initialize model
48- model = TextSummarization()
49-
50- service_provider = TextSummarization.ServiceProvider.OPENAI
51+ model = SpeechToText()
5152
52- # Submit summariztion request
53- job = model.summarize(text = " This is my input text that I want to summarize" , service_provider = service_provider)
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)
5456
5557assert job.status != " ERROR" , f " { job} "
5658print (f " Job ID: { job.id} " )
@@ -59,27 +61,27 @@ print(f"Job ID: {job.id}")
5961response = model.status(job.id, service_provider = service_provider)
6062
6163while response.status == " IN_PROGRESS" :
62- time.sleep(30 )
64+ time.sleep(5 )
6365 response = model.status(job.id, service_provider = service_provider)
64- print (f " Response = { response} . Retrying in 30 seconds " )
66+ print (f " Response = { response} . Retrying in 5 seconds " )
6567
66- return response
68+ print ( response)
6769```
6870
69-
70- #### Convert text to audio
71+ #### Summarize a text input
7172<!-- write a code snippet in the minimum number of lines -->
7273
7374``` python
74- from slashml import TextToSpeech
75+ from slashml import TextSummarization
76+ import time
7577
7678# Initialize model
77- model = TextToSpeech ()
79+ model = TextSummarization ()
7880
79- service_provider = TextToSpeech .ServiceProvider.GOOGLE
81+ service_provider = TextSummarization .ServiceProvider.OPENAI
8082
81- # Submit speechification request
82- job = model.speechify (text = " To be or not to be, that is the question! " , service_provider = service_provider)
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)
8385
8486assert job.status != " ERROR" , f " { job} "
8587print (f " Job ID: { job.id} " )
@@ -88,13 +90,16 @@ print(f"Job ID: {job.id}")
8890response = model.status(job.id, service_provider = service_provider)
8991
9092while response.status == " IN_PROGRESS" :
91- time.sleep(30 )
93+ time.sleep(5 )
9294 response = model.status(job.id, service_provider = service_provider)
93- print (f " Response = { response} . Retrying in 30 seconds " )
95+ print (f " Response = { response} . Retrying in 5 seconds " )
9496
95- return response
97+ print ( response)
9698```
9799
100+
101+
102+
98103### View the list of service providers available
99104
100105``` python
0 commit comments