Skip to main content

SlashML Python client

SlashML

One API for all your machine learning needs.

Installation guide

pip install slashml

Quickstart

Convert text to audio

from slashml import TextToSpeech
import time

# Initialize model
model = TextToSpeech()

service_provider = TextToSpeech.ServiceProvider.GOOGLE

# Submit speechification request
job = model.speechify(text="To be or not to be, that is the question!", service_provider=service_provider)

assert job.status != "ERROR", f"{job}"
print(f"Job ID: {job.id}")

# check job status
response = model.status(job.id, service_provider=service_provider)

while response.status == "IN_PROGRESS":
    time.sleep(30)
    response = model.status(job.id, service_provider=service_provider)
    print(f"Response = {response}. Retrying in 30 seconds")

print(response)

Transcribe an audio file

from slashml import SpeechToText
import time

# Initialize model
model = SpeechToText()

service_provider = SpeechToText.ServiceProvider.WHISPER
# Submit transcription request
job = model.transcribe(upload_url="https://slashml.s3.ca-central-1.amazonaws.com/c7d38026-3ab4-4a04-ad9e-b6679ab79a87", service_provider=service_provider)

assert job.status != "ERROR", f"{job}"
print(f"Job ID: {job.id}")

# check job status
response = model.status(job.id, service_provider=service_provider)

while response.status == "IN_PROGRESS":
    time.sleep(5)
    response = model.status(job.id, service_provider=service_provider)
    print(f"Response = {response}. Retrying in 5 seconds")

print(response)

Summarize a text input

from slashml import TextSummarization
import time

# Initialize model
model = TextSummarization()

service_provider = TextSummarization.ServiceProvider.OPENAI

# Submit summariztion request
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)

assert job.status != "ERROR", f"{job}"
print(f"Job ID: {job.id}")

# check job status
response = model.status(job.id, service_provider=service_provider)

while response.status == "IN_PROGRESS":
    time.sleep(5)
    response = model.status(job.id, service_provider=service_provider)
    print(f"Response = {response}. Retrying in 5 seconds")

print(response)

View the list of service providers available

from slashml import TextToSpeech

print(TextToSpeech.ServiceProvider.choices())

# you can repeat the same thing for all services 
# print(TextSummarization.ServiceProvider.choices())
# print(SpeechToText.ServiceProvider.choices())

Introduction

Overview

This is the Python client (SDK) for SlashML. It allows users to use the endpoints available and active https://docs.slashml.com.

Set up and usage

There is a daily limit (throttling) on the number of calls the user performs. The code can run without specifying the API key. The throttling kicks in and prevents new jobs after exceeding 10 calls per minute.

If the user intends on using the service more frequently, it is recommended to generate an token or API key from https://www.slashml.com/settings/api-key. You can pass the API key when creating a model, if you don't the api will still work but you will be throttled.

from slashml import TextToSpeech

# Initialize model
text_to_speech = TextToSpeech(api_key="YOUR_API_KEY")

# summarizer = TextSummarization(api_key="YOUR_API_KEY")
# speech_to_text = SpeechToText(api_key="YOUR_API_KEY")

If the user preferes using the API calls directly, the documentation is available here.

Available service providers

Speech-to-text

For transcription, SlashML supports the following service providers:

Summarization

For text summarization, SlashML supports the following service providers:

Text-to-Speech

For speechification, SlashML supports the following service providers:

Documentation

For production ready use cases, look at the examples folder

Metadata

Release files for slashml 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slashml 0.0.5
File Size Uploaded
slashml-0.0.5.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for slashml 0.0.5
File Interpreter ABI Platform
slashml-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / slashml-0.0.5.tar.gz

Download URL slashml-0.0.5.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
de498ae50ad81f9f7c59aa8e84b911bd59e5ca2daf261a9e3f0dd0d6597a28c7
BLAKE2b-256 checksum
How to use checksums
caf1cf00a2e3fc2c15d896576b4b9d8e33873307965692464d17fa6b1dc3e98d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.3

Release files / slashml-0.0.5-py3-none-any.whl

Download URL slashml-0.0.5-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
642eeb5f3e87a14565f54faeba15fa5d9336ad3344d4499c7bdf910414ea8d07
BLAKE2b-256 checksum
How to use checksums
f5d084262eb32fff90c0c9439ce2359611f9fe995b75b97610026fd831026ea3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.3

Release history Release notifications | RSS feed

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.0

2 release files

0.0.6

2 release files

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page