File size: 674 Bytes
b5b2ed1
 
 
 
 
698b921
b5b2ed1
 
 
 
74150f4
 
b5b2ed1
f969e93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import gradio as gr

def return_yt_html_embed(yt_url):
    video_id = yt_url.split("?v=")[-1]
    HTML_str = (
        f'<center> <iframe allowfullscreen width="500" height="320" src="https://www.youtube.com/embed/{video_id}"> </iframe>'
        " </center>"
    )
    return HTML_str

'''<iframe width="560" height="315" src="https://www.youtube.com/embed/byk8H1xuOso?si=j7LxhAtLAjq-vd4_" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>'''

iface = gr.Interface(fn=return_yt_html_embed, inputs="text", outputs="html")
iface.launch(share=True)