BenDaouda's picture
Create first version of app.py
1f855d9
raw
history blame
563 Bytes
import requests
import sounddevice as sd
import soundfile as sf
import gradio as gr
API_URL = "https://api-inference.huggingface.co/models/BenDaouda/wav2vec2-large-xls-r-300m-wolof-test-coloab"
headers = {"Authorization": "Bearer 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"}
def query(filename):
with open(filename, "rb") as f:
data = f.read()
response = requests.post(API_URL, headers=headers, data=data)
return response.json()
iface = gr.Interface(fn=query,inputs=gr.Audio(source="microphone", type="filepath"),output="text")
iface.launch()