stt_ner / app.py
abduaziz's picture
Upload folder using huggingface_hub
f122ddf verified
raw
history blame
928 Bytes
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__":
os.environ['HF_TOKEN'] = os.getenv("HUGGINGFACE_TOKEN")
login()
AudioSpeechNERPipeline()
main()