Download app.py from MusIre/test: direct link, hf CLI and curl.
- Browser
- Download file 812 Bytes
-
https://huggingface.co/spaces/MusIre/test/resolve/main/app.py
- Command line
-
hf download hf://spaces/MusIre/test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/MusIre/test/resolve/main/app.py
812 Bytes
| import subprocess | |
| subprocess.run(["pip", "install", "whisper"]) | |
| subprocess.run(["pip", "install", "gradio", "--upgrade"]) | |
| subprocess.run(["pip", "install", "pip", "--upgrade"]) | |
| import gradio as gr | |
| import whisper | |
| def transcribe_audio(audio_file): | |
| model = whisper.load_model("base") | |
| result = model.transcribe(audio_file) | |
| return result["text"] | |
| def main(): | |
| audio_input = gr.inputs.Audio(source="upload", type="filepath") | |
| output_text = gr.outputs.Textbox() | |
| iface = gr.Interface(fn=transcribe_audio, inputs=audio_input, | |
| outputs=output_text, title="Audio Transcription App", | |
| description="Upload an audio file and hit the 'Submit'\ | |
| button") | |
| iface.launch() | |
| if __name__ == '__main__': | |
| main() |