|
import gradio as gr |
|
|
|
import tempfile |
|
import os |
|
|
|
|
|
YT_LENGTH_LIMIT_S = 3600 |
|
FILE_LIMIT_MB = 1000 |
|
|
|
def _return_yt_html_embed(yt_url): |
|
video_id = yt_url.split("?v=")[-1] |
|
HTML_str = ( |
|
f'<center> <iframe width="500" height="320" src="https://www.youtube.com/embed/{video_id}"> </iframe>' |
|
" </center>" |
|
) |
|
return HTML_str |
|
demo = gr.Interface( |
|
fn=_return_yt_html_embed, |
|
inputs="text", |
|
|
|
outputs="html", |
|
layout="horizontal", |
|
theme="huggingface", |
|
title="YouTube Video Viwer", |
|
description=("YouTube Video Viwer"), |
|
allow_flagging="never", |
|
) |
|
|
|
demo.queue(max_size=20).launch() |