File size: 727 Bytes
495b2ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

import gradio as gr

def process_audio(audio_file):
    if audio_file is None:
        return "Please upload an audio file."
    
    try:
        result = transcribe_audio(audio_file)
        return f"**Transcription:**\\n{result['text']}\\n\\n**Language:** {result['language']}"
    except Exception as e:
        return f"Error processing audio: {str(e)}"

# Create Gradio interface
demo = gr.Interface(
    fn=process_audio,
    inputs=gr.Audio(type="filepath"),
    outputs=gr.Markdown(),
    title="Whisper.cpp Speech-to-Text",
    description="Upload an audio file to transcribe it using Whisper.cpp (local processing)",
    examples=[
        # Add example audio files here
    ]
)

demo.launch()