Spaces:
Sleeping
Sleeping
| 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() | |