File size: 1,269 Bytes
2c4cfe6
0493d0d
5bf7330
2c4cfe6
0493d0d
2c4cfe6
0493d0d
5bf7330
 
2c4cfe6
 
0493d0d
2c4cfe6
 
5bf7330
2c4cfe6
0493d0d
07614d2
 
0493d0d
2c4cfe6
 
0493d0d
 
 
2c4cfe6
 
 
 
 
 
 
0493d0d
 
 
bfbc50c
0493d0d
 
2c4cfe6
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
30
31
32
33
34
35
36
37
38
39
from transformers import pipeline
import gradio as gr

# Load Whisper model
print("Loading model...")
pipe = pipeline(model="jsbeaudry/oswald-large-v3-turbo-m1")
print("Model loaded successfully.")

# Transcription function
def transcribe(audio_path):
    if audio_path is None:
        return "Please upload or record an audio file first."
    result = pipe(audio_path)
    return result["text"]

# Build Gradio interface
def create_interface():
    with gr.Blocks(title="Oswald Turbo M1 - Haitian Creole") as demo:
        gr.Markdown("# πŸŽ™οΈ oswald turbo m1 Creole ASR")
        gr.Markdown(
            "Upload an audio file or record your voice in Haitian Creole. "
            "Then click **Transcribe** to see the result."
        )

        with gr.Row():
            with gr.Column():
                audio_input = gr.Audio( type="filepath", label="🎧 Upload Audio")
            with gr.Column():
                transcribe_button = gr.Button("πŸ” Transcribe")
                output_text = gr.Textbox(label="πŸ“ Transcribed Text", lines=4)
                
    
        transcribe_button.click(fn=transcribe, inputs=audio_input, outputs=output_text)

    return demo

if __name__ == "__main__":
    interface = create_interface()
    interface.launch()