Transcription audio
Transcrire un fichier audio
curl -sS "https://albert.api.etalab.gouv.fr/v1/audio/transcriptions" \
-H "Authorization: Bearer $ALBERT_API_KEY" \
-F "file=@enregistrement.mp3" \
-F "model=REMPLACER_PAR_MODELE_ASR" \
-F "language=fr" \
-F "response_format=json"Exemples (curl / Python / JavaScript)
curl -sS "https://albert.api.etalab.gouv.fr/v1/audio/transcriptions" \
-H "Authorization: Bearer $ALBERT_API_KEY" \
-F "file=@enregistrement.mp3" \
-F "model=REMPLACER_PAR_MODELE_ASR" \
-F "language=fr"import os
from openai import OpenAI
client = OpenAI(
base_url="https://albert.api.etalab.gouv.fr/v1",
api_key=os.environ["ALBERT_API_KEY"],
)
with open("enregistrement.mp3", "rb") as f:
tr = client.audio.transcriptions.create(
model="REMPLACER_PAR_MODELE_ASR",
file=f,
language="fr",
)
print(tr.text)import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://albert.api.etalab.gouv.fr/v1",
apiKey: process.env.ALBERT_API_KEY,
});
const tr = await client.audio.transcriptions.create({
model: "REMPLACER_PAR_MODELE_ASR",
file: fs.createReadStream("enregistrement.mp3"),
language: "fr",
});
console.log(tr.text);Choisir response_format
Last updated
Was this helpful?