ahmedJaafari's picture
Update app.py
d39fba0 verified
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 [email protected].\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()