Spaces:
Runtime error
Runtime error
File size: 1,044 Bytes
509a7f8 eebf6b7 509a7f8 4063dfa 509a7f8 4063dfa 509a7f8 4063dfa 509a7f8 7edda7c 509a7f8 7edda7c 4063dfa 509a7f8 43eb69b 509a7f8 7edda7c 509a7f8 d39fba0 bd44a56 509a7f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import gradio as gr
from gradio_client import Client, handle_file
import os
client = Client(f"ahmedJaafari/{os.getenv('API_ENDPOINT')}", hf_token=os.getenv("API_KEY"))
def classify_audio(audio, choice):
# Simulating the classification result based on audio
result = client.predict(
audio=handle_file(audio),
choice=choice,
api_name="/predict"
)
transcript = result
return transcript
iface = gr.Interface(
fn=classify_audio,
inputs=[
gr.Audio(type="filepath", label="Record Audio"),
gr.Radio(["Normal", "Advanced"], label="Select Model")
],
outputs=[
gr.Textbox(label="Transcript") # Transcript of the audio
],
title="Vochai - Transcription",
description=(
"Developed by Vochai. For more information, visit [Voch.ai](https://voch.ai) or contact us at contact@voch.ai.\n\n"
"N.B. This Tool is for demonstration purposes only, the results may not be 100% accurate and the speed is slower than usual."
),
)
iface.launch()
|