kokohachi commited on
Commit ·
77cc7f5
1
Parent(s): 69d9618
change
Browse files- app.py +22 -0
- index.html +6 -0
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def update(video):
|
| 4 |
+
return f'''
|
| 5 |
+
<body>
|
| 6 |
+
<div>
|
| 7 |
+
<h2>YouTube埋め込み</h2>
|
| 8 |
+
<iframe width="1600" height="900" src="https://www.youtube-nocookie.com/embed/{{video}}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
| 9 |
+
</div>
|
| 10 |
+
</body>
|
| 11 |
+
'''
|
| 12 |
+
|
| 13 |
+
with gr.Blocks() as demo:
|
| 14 |
+
gr.Markdown("Youtubeの動画IDを入力してください。")
|
| 15 |
+
with gr.Row():
|
| 16 |
+
inp = gr.Textbox(placeholder="ID")
|
| 17 |
+
with gr.Row():
|
| 18 |
+
out = gr.HTML()
|
| 19 |
+
|
| 20 |
+
inp.change(fn=update, inputs=inp, outputs=out)
|
| 21 |
+
|
| 22 |
+
demo.launch()
|
index.html
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<body>
|
| 2 |
+
<div>
|
| 3 |
+
<h2>YouTube埋め込み</h2>
|
| 4 |
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/3O4J6E7ERjc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
| 5 |
+
</div>
|
| 6 |
+
</body>
|