import gradio as gr modelo_path = "models/proxectonos/Nos_ASR-wav2vec2-large-xlsr-53-gl-with-lm" modelo = gr.load(modelo_path) def cargar(audio): outtext = modelo(audio) print(outtext) texto_transcrito = outtext.split("'")[1].strip() print(texto_transcrito) return texto_transcrito with gr.Blocks(analytics_enabled=False) as demo: with gr.Row(): with gr.Column(): gr.Markdown( """ ## """ ) with gr.Column(): with gr.Row(): gr.Markdown( """
💻 Este space mostra o modelo ASR desenvolvido polo **[Proxecto Nós](https://huggingface.co/proxectonos)**.
""" ) with gr.Row(): input_audio = gr.Audio(label="Entrada", type="filepath") with gr.Row(): output_text = gr.Textbox(label="Saida") with gr.Row(): asr_button = gr.Button("Enviar", elem_id="send-btn", visible=True) asr_button.click( cargar, inputs=[ input_audio, ], outputs=[output_text], ) demo.launch(debug=True)