gooya-asr / app.py
navidved's picture
connect hf to luxi asr api
d2d0553 verified
raw
history blame
878 Bytes
import gradio as gr
import requests
def transcribe_audio(file):
# Prepare headers and data
headers = {
'accept': 'application/json',
'Authorization': AUTH_TOKEN,
}
files = {
'file': (file.name, file, 'audio/mpeg'),
}
# Send POST request
response = requests.post(ASR_API_URL, headers=headers, files=files)
# Check if response is successful
if response.status_code == 200:
return response.json().get("transcription", "No transcription returned.")
else:
return f"Error: {response.status_code}, {response.text}"
# Set up the Gradio interface
gr.Interface(
fn=transcribe_audio,
inputs=gr.Audio(source="upload", type="file"),
outputs="text",
title="Gooya v1 Persian Speech Recognition",
description="Upload an audio file in Persian, and this model will transcribe it."
).launch()