Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	| import os | |
| os.system("pip install git+https://github.com/openai/whisper.git") | |
| import whisper | |
| from pytube import YouTube | |
| import gradio as gr | |
| infer_model = whisper.load_model("base") | |
| def infer(link): | |
| audio_path = download_audio(link) | |
| if audio_path is None: | |
| return "Unable to process request." | |
| result = infer_model.transcribe(audio_path) | |
| print(result["text"]) | |
| return result["text"] | |
| def download_audio(link): | |
| try: | |
| yt = YouTube(link) | |
| stream = yt.streams.get_audio_only() | |
| audio_path = stream.download() | |
| print(audio_path) | |
| return audio_path | |
| except Exception as e: | |
| print(f"Unable to download file. Exception {e}") | |
| return None | |
| demo = gr.Interface( | |
| fn=infer, | |
| inputs= "text", | |
| outputs= "text" | |
| ) | |
| demo.launch() |