Spaces:
Running
Running
| import gradio as gr | |
| with gr.Blocks() as demo: | |
| with gr.Row(): | |
| gr.Image("logo.png", elem_id="logo", show_label=False) | |
| gr.Markdown("## π₯ Video to Text Generator") | |
| # Your existing UI components here... | |
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the ASR model once (faster, avoids reloading each time) | |
| asr = pipeline("automatic-speech-recognition", model="openai/whisper-small") | |
| def video_to_text(video_file): | |
| if video_file is None: | |
| return "Please upload a video file." | |
| text = asr(video_file)["text"] | |
| return text | |
| with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo: | |
| gr.Markdown("# π₯ Video-to-Text AI Tool\nUpload a video and get the transcript instantly.") | |
| video_input = gr.Video(label="Upload Video") | |
| transcript_output = gr.Textbox(label="Transcript", lines=10) | |
| btn = gr.Button("Generate Transcript") | |
| btn.click(video_to_text, inputs=video_input, outputs=transcript_output) | |
| demo.launch() |