import gradio as gr modelo_path = "models/proxectonos/Nos_ASR-wav2vec2-large-xlsr-53-gl-with-lm" modelo = gr.load(modelo_path) fronted_theme = "Soft" def cargar(audio): outtext = modelo(audio) texto_transcrito = outtext.split("'")[1].strip() return texto_transcrito custom_css = """ #send-btn { background-color: blue; color: white; } #clear-btn { background-color: green; color: white; } #send-btn:hover { box-shadow: 3px 3px 5px #0056b3; } #clear-btn:hover { box-shadow: 3px 3px 5px #1e7e34; } """ with gr.Blocks(fronted_theme, css=custom_css) as demo: with gr.Row(): with gr.Column(): gr.Markdown( """ ##

🗣️📄 ASR Demo Proxecto Nós

""" ) 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="Saída", type="text") with gr.Row(): asr_button = gr.Button("Xerar", elem_id="send-btn", visible=True) clear_button = gr.ClearButton([input_audio, output_text], value="Limpar", elem_id="clear-btn", visible=True) asr_button.click( cargar, inputs=[ input_audio, ], outputs=[output_text], ) examples = gr.Examples( ["Celtia1.wav"], inputs=[input_audio], label="Exemplo" ) demo.launch(debug=True)