File size: 913 Bytes
f122ddf 2d6c46c f122ddf |
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 |
import gradio as gr
import os
from pipe import process_audio_pipeline, AudioSpeechNERPipeline
from huggingface_hub import login
def create_gradio_interface():
# Create Gradio interface
iface = gr.Interface(
fn=process_audio_pipeline,
inputs=gr.Audio(type="filepath", label="Upload Audio"),
outputs=[
gr.Textbox(label="Transcription"),
gr.Textbox(label="Named Entities")
],
title="Uzbek Speech Recognition and Named Entity Recognition",
description="Upload an Uzbek audio file (MP3 or WAV) to transcribe and extract named entities."
)
return iface
def main():
# Create and launch the Gradio interface
demo = create_gradio_interface()
demo.launch(share=True)
if __name__ == "__main__":
login(token=os.getenv('HF_TOKEN'), new_session=False)
AudioSpeechNERPipeline()
main()
|