from transformers import pipeline import gradio as gr import time from video_downloader import download_video from moviepy.editor import AudioFileClip import datetime import os pipe = pipeline("automatic-speech-recognition", model="Artanis1551/whisper_romanian3") def process_video(date): # Download the video video_path = download_video(date) # Extract audio from the video audio_path = f"audio_{date}.wav" AudioFileClip(video_path).write_audiofile(audio_path) # Transcribe the audio with open(audio_path, "rb") as audio_file: audio = audio_file.read() transcription = pipe(audio)["text"] # Remove the audio file os.remove(audio_path) return video_path, transcription iface = gr.Interface( fn=process_video, inputs=gr.inputs.Textbox(label="Date with format YYYYMMDD"), outputs=[ gr.outputs.Video(), gr.outputs.Textbox(lines=1000, max_lines=1000, interactive=True), ], title="Romanian Transcription Test", ) iface.launch()