Spaces:
Runtime error
Runtime error
Siddiqui Qamar commited on
Create app.py
Browse files12345678910111213141516171819202122232425262728293031323334import gradio as grimport whisperimport os
# Load the Whisper modelmodel = whisper.load_model("base")
def transcribe_audio(audio_file): # Transcribe the audio result = model.transcribe(audio_file.name) # Get the base name of the file (without extension) for the output file output_filename = os.path.splitext(os.path.basename(audio_file.name))[0] + ".txt" # Save the transcript to a text file with the same name as the input file with open(output_filename, "w") as text_file: text_file.write(result["text"]) return result["text"], output_filename
# Create Gradio interfaceiface = gr.Interface( fn=transcribe_audio, inputs=gr.File(label="Upload Audio File"), outputs=[ gr.Textbox(label="Transcription"), gr.File(label="Download Transcript") ], title="Audio Transcription Tool", description="Upload an audio file (WAV, MP3, etc.) to get its transcription. The transcript will be displayed and available for download.")
# Launch the interfaceiface.launch()app.pyAdded+34