Rest api supporter
Project description
rest-api-supporter
https://pypi.org/project/rest-api-supporter/
pip install rest-api-supporter
Supported APIs
from rest_api_supporter.utils.base64_decode import base64_decode
print(full_encoded) #data:image/png;base64,/9j/4AAQSkZJRgABAQ...2qjR37P/2Q==
#data:audio/wav;base64,UklGRiTuAgBXQVZFZm...At84WACNZGwA=
#/9j/4AAQSkZJRgABAQ...2qjR37P/2Q==
base64_decoded = base64_decode(full_encoded)
print(type(base64_decoded)) #<class 'PIL.JpegImagePlugin.JpegImageFile'>
#<class 'bytes'>
#<class 'PIL.JpegImagePlugin.JpegImageFile'>
from rest_api_supporter.utils.base64_encode import base64_encode
image = Image.open("rock.jpg")
base64 = base64_encode(image)
print(base64) #data:image/png;base64,/9j/4AAQSkZJRgABAQ...2qjR37P/2Q==
from rest_api_supporter.utils.base64_encode import base64_encode
import datasets
path = 'up.wav'
dataset = datasets.Dataset.from_dict({"audio": [path]})
dataset = dataset.cast_column("audio", datasets.Audio())
array = dataset[0]["audio"]["array"]
#sampling_rate = dataset[0]["audio"]["sampling_rate"] #Wav2Vec2FeatureExtractor was trained using a sampling rate of 16000. Please make sure that the provided `raw_speech` input was sampled with 16000 and not 8000.
sampling_rate = 16000
base64 = base64_encode(array)
print(base64) #data:audio/wav;base64,UklGRiTuAgBXQVZFZm...At84WACNZGwA=
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rest-api-supporter-0.0.10.tar.gz
.
File metadata
- Download URL: rest-api-supporter-0.0.10.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba57cf547de7ec6b140b5f74be50b268573f155d74ffc15b8d796ba303bfa7db |
|
MD5 | c9a281affdecbef910f8aa33500788e3 |
|
BLAKE2b-256 | 1fe0656909d9f1474d3e49b3b82e0f4dd51f47081347e870c90c002cbfa88b85 |
File details
Details for the file rest_api_supporter-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: rest_api_supporter-0.0.10-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a5388a88f615a831f077776517672c2c11e30a55662db682cd4119bc7923ce1 |
|
MD5 | f6f9b6391fbf1e019f48e86f2af42695 |
|
BLAKE2b-256 | 76f323feb9773b843a5bb2e64d603d2f495a5d0bfd16e14cb426599cdc1a0501 |