RepoDeepInfraDeepInfrapublished Mar 21, 2024seen 2w

deepinfra/deepinfra-python

Python

Open original ↗

Captured source

source ↗
published Mar 21, 2024seen 2wcaptured 2whttp 200method plain

deepinfra/deepinfra-python

Description: Unofficial Python wrapper for the DeepInfra Inference API

Language: Python

License: MIT

Stars: 1

Forks: 0

Open issues: 7

Created: 2024-03-21T16:42:17Z

Pushed: 2026-07-10T06:04:10Z

Default branch: main

Fork: no

Archived: no

README:

deepinfra

![CI](https://github.com/deepinfra/deepinfra-python/actions/workflows/ci.yml) ![PyPI version](https://pypi.org/project/deepinfra/)

deepinfra is a Python library designed to provide a simple interface for interacting with DeepInfra's Inference API, facilitating various AI and machine learning tasks.

Installation

To install deepinfra, run the following command:

pip install deepinfra

Examples

Use Automatic Speech Recognition

You can use the Automatic Speech Recognition (ASR) API to transcribe audio files, URLs and buffer objects.

Transcribe an audio file

from deepinfra import AutomaticSpeechRecognition

model_name = "openai/whisper-base"
asr = AutomaticSpeechRecognition(model_name)

file_path = "path/to/audio/file"
body = {
"audio": file_path
}
transcription = asr.generate(body)
print(transcription["text"])

Transcribe an audio URL

from deepinfra import AutomaticSpeechRecognition

model_name = "openai/whisper-base"
asr = AutomaticSpeechRecognition(model_name)

url = "https://path/to/audio/file"
body = {
"audio": url
}
transcription = asr.generate(body)
print(transcription["text"])