Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
YOUTUBE_LINKS = [
|
| 4 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 5 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 6 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 7 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 8 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 9 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 10 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 11 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 12 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 13 |
+
"https://www.youtube.com/watch?v=g30KR9VNXS0",
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
def youtube_embed(url):
|
| 17 |
+
video_id = url.split("v=")[-1]
|
| 18 |
+
return f"""
|
| 19 |
+
<iframe
|
| 20 |
+
width="100%"
|
| 21 |
+
height="220"
|
| 22 |
+
src="https://www.youtube-nocookie.com/embed/{video_id}?rel=0&modestbranding=1"
|
| 23 |
+
frameborder="0"
|
| 24 |
+
allow="accelerometer; encrypted-media; gyroscope; picture-in-picture"
|
| 25 |
+
allowfullscreen>
|
| 26 |
+
</iframe>
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
css = """
|
| 30 |
+
body {
|
| 31 |
+
background-color: #0b0f19;
|
| 32 |
+
}
|
| 33 |
+
.tc-header {
|
| 34 |
+
font-size: 34px;
|
| 35 |
+
font-weight: 800;
|
| 36 |
+
color: #e5e7eb;
|
| 37 |
+
margin-bottom: 6px;
|
| 38 |
+
}
|
| 39 |
+
.tc-sub {
|
| 40 |
+
font-size: 14px;
|
| 41 |
+
color: #9ca3af;
|
| 42 |
+
margin-bottom: 24px;
|
| 43 |
+
}
|
| 44 |
+
.video-card {
|
| 45 |
+
background: #111827;
|
| 46 |
+
border-radius: 14px;
|
| 47 |
+
padding: 10px;
|
| 48 |
+
box-shadow: 0 12px 32px rgba(0,0,0,0.45);
|
| 49 |
+
}
|
| 50 |
+
"""
|
| 51 |
+
|
| 52 |
+
with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
|
| 53 |
+
gr.HTML("""
|
| 54 |
+
<div class="tc-header">TC Channel — Curated Videos</div>
|
| 55 |
+
<div class="tc-sub">
|
| 56 |
+
Only selected videos • No recommendations • Clean playback
|
| 57 |
+
</div>
|
| 58 |
+
""")
|
| 59 |
+
|
| 60 |
+
for i in range(0, 10, 3):
|
| 61 |
+
with gr.Row():
|
| 62 |
+
for j in range(3):
|
| 63 |
+
if i + j < 10:
|
| 64 |
+
gr.HTML(
|
| 65 |
+
f"<div class='video-card'>{youtube_embed(YOUTUBE_LINKS[i + j])}</div>"
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
demo.launch()
|