File size: 664 Bytes
0896dbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3355704
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gradio as gr
# import yt_dlp as youtube_dl
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", "text"],
    outputs="html",
    layout="horizontal",
    theme="huggingface",
    title="YouTube Video Viwer",
    description=("YouTube Video Viwer"),
    allow_flagging="never",
)

demo.launch()