Spaces:
Running
Running
with gr.Row(): | |
with gr.Column(): | |
# Dropdown pour sélectionner le modèle | |
model_selector = gr.Dropdown( | |
choices=["model_1.pth", "model_2.pth", "model_3.pth"], | |
value="model_3.pth", | |
label="Choisissez le modèle" | |
) | |
# Créer des onglets pour Microphone et Upload Audio | |
with gr.Tab("Microphone"): | |
mic_input = gr.Audio(sources=["microphone"], type="filepath", label="🎙️ Enregistrer depuis le microphone") | |
with gr.Tab("Upload Audio"): | |
file_input = gr.Audio(sources=["upload"], type="filepath", label="📁 Télécharger un fichier audio") | |
# Bouton pour démarrer la reconnaissance | |
record_btn = gr.Button("Reconnaître") | |
with gr.Column(): | |
# Résultat, graphique et texte reconnu | |
result_text = gr.Textbox(label="Résultat") | |
plot_output = gr.Plot(label="Confiance par locuteur") | |
recognized_text = gr.Textbox(label="Texte reconnu") | |
audio_output = gr.Audio(label="Synthèse vocale", visible=False) | |
# Fonction de clique pour la reconnaissance | |
def recognize(audio, selected_model): | |
# Traitement audio et modèle à charger... | |
pass # Remplace ici avec ton code de traitement | |
# Lier le bouton "Reconnaître" à la fonction | |
record_btn.click( | |
fn=recognize, | |
inputs=[mic_input, file_input, model_selector], # Remplacer Union par les deux inputs distincts | |
outputs=[result_text, plot_output, recognized_text, audio_output] | |
) |