Commit ·
f24729d
1
Parent(s): 171421d
Add component: Video Slider
Browse files- components/video-slider.json +20 -0
- manifest.json +12 -0
components/video-slider.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id": "video-slider",
|
| 3 |
+
"name": "Video Slider",
|
| 4 |
+
"description": "A high-performance video comparison component for Gradio apps. It allows users to compare two videos side-by-side with a draggable slider, featuring frame-accurate synchronization and built-in audio/fullscreen controls.",
|
| 5 |
+
"author": "elismasilva",
|
| 6 |
+
"tags": [
|
| 7 |
+
"video",
|
| 8 |
+
"video-comparison",
|
| 9 |
+
"slider"
|
| 10 |
+
],
|
| 11 |
+
"html_template": "\n <div class=\"vs-container\">\n <div class=\"vs-upload-grid\" style=\"display: grid\">\n <div class=\"vs-box\" id=\"up-l\">\n <input type=\"file\" id=\"in-l\" style=\"display:none\" accept=\"video/*\">\n <div class=\"vs-def\">\n <div class=\"vs-icon-placeholder\">\ud83c\udf9e\ufe0f</div>\n <div class=\"vs-label-text\">Video A (Original)</div>\n </div>\n <div class=\"vs-ok\"><svg width=\"48\" height=\"48\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"#10b981\"/><path d=\"M8 12L11 15L16 9\" stroke=\"white\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg><div class=\"vs-label-text\">Video Loaded</div></div>\n </div>\n <div class=\"vs-box\" id=\"up-r\">\n <input type=\"file\" id=\"in-r\" style=\"display:none\" accept=\"video/*\">\n <div class=\"vs-def\">\n <div class=\"vs-icon-placeholder\">\ud83e\ude84</div>\n <div class=\"vs-label-text\">Video B (Processed)</div>\n </div>\n <div class=\"vs-ok\"><svg width=\"48\" height=\"48\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"#10b981\"/><path d=\"M8 12L11 15L16 9\" stroke=\"white\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg><div class=\"vs-label-text\">Video Loaded</div></div>\n </div>\n </div>\n\n <div class=\"vs-player\" style=\"height: 400px; display: none;\" data-value='${JSON.stringify(value)}'>\n <video class=\"v-base\" playsinline loop muted></video>\n <video class=\"v-top\" playsinline loop muted></video>\n <div class=\"v-handle\"></div>\n <div class=\"v-btns\">\n <button class=\"v-btn\" id=\"btn-fs\" title=\"Fullscreen\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3\"></path></svg></button>\n <button class=\"vs-btn\" id=\"btn-mute\" title=\"Mute\"><svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M18 14L22 10M22 14L18 10M2 13.8V10.2C2 9 3 8 4 8H7L13 4V20L7 16H4C3 16 2 15 2 13.8Z\"/></svg></button>\n </div>\n <div class=\"v-play-overlay\">\u25b6</div>\n </div>\n </div>\n ",
|
| 12 |
+
"css_template": "\n .vs-container {\n width: 100%;\n font-family: 'Inter', sans-serif;\n min-height: 50px;\n }\n\n .vs-upload-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 15px;\n margin-bottom: 15px;\n }\n\n .vs-box {\n border: 2px dashed var(--border-color-primary);\n border-radius: 16px;\n height: 110px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: var(--background-fill-secondary);\n cursor: pointer;\n transition: all 0.3s ease;\n }\n\n .vs-box:hover {\n border-color: var(--color-accent);\n background: var(--background-fill-primary);\n transform: translateY(-2px);\n }\n\n .vs-def,\n .vs-ok {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n height: 100%;\n }\n\n .vs-icon-placeholder {\n font-size: 1.2rem;\n line-height: 1;\n }\n\n .vs-label-text {\n font-size: 1.05rem;\n font-weight: 500;\n color: var(--body-text-color);\n }\n\n .vs-box.has-v {\n border: 2.5px solid #10b981;\n background: rgba(16, 185, 129, 0.08);\n }\n\n .vs-box.has-v .vs-def {\n display: none;\n }\n\n .vs-ok {\n display: none;\n }\n\n .vs-box.has-v .vs-ok {\n display: flex;\n }\n\n .vs-player {\n position: relative;\n width: 100%;\n background: #000;\n border-radius: 12px;\n overflow: hidden;\n cursor: ew-resize;\n border: 1px solid #444;\n }\n\n .vs-player video {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .v-top {\n z-index: 2;\n }\n\n .v-handle {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 4px;\n margin-left: -2px;\n background: var(--color-accent);\n z-index: 10;\n pointer-events: none;\n }\n\n .v-handle::after {\n content: '\u2194';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 44px;\n height: 44px;\n background: var(--color-accent);\n border-radius: 50%;\n border: 3px solid white;\n color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: bold;\n font-size: 20px;\n box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);\n }\n\n .v-btns {\n position: absolute;\n top: 15px;\n right: 15px;\n z-index: 30;\n display: flex;\n gap: 8px;\n }\n\n .vs-btn,\n .v-btn {\n background: #111 !important;\n border: 2px solid #444;\n border-radius: 10px;\n width: 48px;\n height: 48px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .v-btn svg,\n .vs-btn svg {\n width: 26px;\n height: 26px;\n color: white !important;\n stroke: white !important;\n stroke-width: 2.5px !important;\n }\n\n .v-play-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.3);\n z-index: 20;\n color: white;\n font-size: 60px;\n pointer-events: none;\n opacity: 1;\n transition: 0.2s;\n }\n\n .vs-player.playing .v-play-overlay {\n opacity: 0;\n }\n ",
|
| 13 |
+
"js_on_load": "\n const c = element.querySelector('.vs-player');\n if (!c) return;\n const v1 = c.querySelector('.v-base');\n const v2 = c.querySelector('.v-top');\n const h = c.querySelector('.v-handle');\n const bxs = element.querySelectorAll('.vs-box');\n \n const iVol = `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M1 13.8V10.2C1 9 2 8 3 8H6L12 4V20L6 16H3C2 16 1 15 1 13.8Z\"/><path d=\"M17 8C17 8 19 10 19 12C19 14 17 16 17 16\"/><path d=\"M21 5C21 5 24 9 24 12C24 15 21 19 21 19\"/></svg>`;\n const iMute = `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M18 14L22 10M22 14L18 10M2 13.8V10.2C2 9 3 8 4 8H7L13 4V20L7 16H4C3 16 2 15 2 13.8Z\"/></svg>`;\n const iMax = `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3\"></path></svg>`;\n const iMin = `<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3\"></path></svg>`;\n \n const applyVideos = (data) => {\n if (data && data.length === 2 && data[0] && data[1]) {\n v1.src = data[0]; \n v2.src = data[1];\n c.style.display = 'block';\n bxs.forEach(b => b.classList.add('has-v'));\n }\n };\n\n const observer = new MutationObserver(() => {\n try {\n const newValue = JSON.parse(c.getAttribute('data-value'));\n applyVideos(newValue);\n } catch(e) {}\n });\n observer.observe(c, { attributes: true, attributeFilter: ['data-value'] });\n \n applyVideos(props.value);\n\n const iL = element.querySelector('#in-l');\n const iR = element.querySelector('#in-r');\n if (iL && iR) {\n const up = (file, idx) => {\n const r = new FileReader();\n r.onload = (e) => {\n const b64 = e.target.result;\n if(idx===0) v1.src = b64; else v2.src = b64;\n bxs[idx].classList.add('has-v');\n if(v1.src && v2.src) {\n c.style.display = 'block';\n props.value = [v1.src, v2.src];\n trigger('change');\n }\n };\n r.readAsDataURL(file);\n };\n iL.onchange = e => up(e.target.files[0], 0);\n iR.onchange = e => up(e.target.files[0], 1);\n bxs[0].onclick = () => iL.click();\n bxs[1].onclick = () => iR.click();\n }\n \n const bM = element.querySelector('#btn-mute');\n bM.onclick = e => { e.stopPropagation(); v1.muted = !v1.muted; bM.innerHTML = v1.muted ? iMute : iVol; };\n const bF = element.querySelector('#btn-fs');\n bF.onclick = e => { e.stopPropagation(); if(!document.fullscreenElement) c.requestFullscreen(); else document.exitFullscreen(); };\n document.addEventListener('fullscreenchange', () => { bF.innerHTML = document.fullscreenElement ? iMin : iMax; });\n\n function refresh(p) {\n p = Math.max(0, Math.min(100, p));\n h.style.left = p + \"%\";\n v2.style.clipPath = `polygon(${p}% 0, 100% 0, 100% 100%, ${p}% 100%)`;\n }\n refresh(50);\n\n c.onmousemove = e => { if(e.buttons===1) refresh(((e.clientX - c.getBoundingClientRect().left)/c.offsetWidth)*100); };\n c.onmousedown = e => { if(!e.target.closest('button')) refresh(((e.clientX - c.getBoundingClientRect().left)/c.offsetWidth)*100); };\n c.onclick = e => { if(e.target.closest('button')) return; if(v1.paused) v1.play(); else v1.pause(); };\n v1.onplay = () => { v2.currentTime = v1.currentTime; v2.play(); c.classList.add('playing'); };\n v1.onpause = () => { v2.pause(); c.classList.remove('playing'); };\n v1.ontimeupdate = () => { if(Math.abs(v1.currentTime - v2.currentTime) > 0.2) v2.currentTime = v1.currentTime; };\n ",
|
| 14 |
+
"default_props": {
|
| 15 |
+
"value": ""
|
| 16 |
+
},
|
| 17 |
+
"python_code": "class VideoSlider(gr.HTML):\n EVENTS = [\"change\"]\n\n def __init__(\n self,\n value: Optional[Tuple[str, str]] = None,\n height: int = 400,\n interactive: bool = True,\n label: str = None,\n **kwargs\n ):\n self.height = height\n self.interactive = interactive\n self.label = label\n\n # Icons\n icons = {\n \"success\": '<svg width=\"48\" height=\"48\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"12\" cy=\"12\" r=\"10\" fill=\"#10b981\"/><path d=\"M8 12L11 15L16 9\" stroke=\"white\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>',\n \"mute\": '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M18 14L22 10M22 14L18 10M2 13.8V10.2C2 9 3 8 4 8H7L13 4V20L7 16H4C3 16 2 15 2 13.8Z\"/></svg>',\n \"volume\": '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M1 13.8V10.2C1 9 2 8 3 8H6L12 4V20L6 16H3C2 16 1 15 1 13.8Z\"/><path d=\"M17 8C17 8 19 10 19 12C19 14 17 16 17 16\"/><path d=\"M21 5C21 5 24 9 24 12C24 15 21 19 21 19\"/></svg>',\n \"maximize\": '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3\"></path></svg>',\n \"minimize\": '<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3\"></path></svg>'\n }\n\n up_display = \"grid\" if self.interactive else \"none\"\n\n html_template = f\"\"\"\n <div class=\"vs-container\">\n <div class=\"vs-upload-grid\" style=\"display: {up_display}\">\n <div class=\"vs-box\" id=\"up-l\">\n <input type=\"file\" id=\"in-l\" style=\"display:none\" accept=\"video/*\">\n <div class=\"vs-def\">\n <div class=\"vs-icon-placeholder\">\ud83c\udf9e\ufe0f</div>\n <div class=\"vs-label-text\">Video A (Original)</div>\n </div>\n <div class=\"vs-ok\">{icons['success']}<div class=\"vs-label-text\">Video Loaded</div></div>\n </div>\n <div class=\"vs-box\" id=\"up-r\">\n <input type=\"file\" id=\"in-r\" style=\"display:none\" accept=\"video/*\">\n <div class=\"vs-def\">\n <div class=\"vs-icon-placeholder\">\ud83e\ude84</div>\n <div class=\"vs-label-text\">Video B (Processed)</div>\n </div>\n <div class=\"vs-ok\">{icons['success']}<div class=\"vs-label-text\">Video Loaded</div></div>\n </div>\n </div>\n\n <div class=\"vs-player\" style=\"height: {self.height}px; display: none;\" data-value='${{JSON.stringify(value)}}'>\n <video class=\"v-base\" playsinline loop muted></video>\n <video class=\"v-top\" playsinline loop muted></video>\n <div class=\"v-handle\"></div>\n <div class=\"v-btns\">\n <button class=\"v-btn\" id=\"btn-fs\" title=\"Fullscreen\">{icons['maximize']}</button>\n <button class=\"vs-btn\" id=\"btn-mute\" title=\"Mute\">{icons['mute']}</button>\n </div>\n <div class=\"v-play-overlay\">\u25b6</div>\n </div>\n </div>\n \"\"\"\n\n css_template = \"\"\"\n .vs-container {\n width: 100%;\n font-family: 'Inter', sans-serif;\n min-height: 50px;\n }\n\n .vs-upload-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 15px;\n margin-bottom: 15px;\n }\n\n .vs-box {\n border: 2px dashed var(--border-color-primary);\n border-radius: 16px;\n height: 110px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: var(--background-fill-secondary);\n cursor: pointer;\n transition: all 0.3s ease;\n }\n\n .vs-box:hover {\n border-color: var(--color-accent);\n background: var(--background-fill-primary);\n transform: translateY(-2px);\n }\n\n .vs-def,\n .vs-ok {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 10px;\n width: 100%;\n height: 100%;\n }\n\n .vs-icon-placeholder {\n font-size: 1.2rem;\n line-height: 1;\n }\n\n .vs-label-text {\n font-size: 1.05rem;\n font-weight: 500;\n color: var(--body-text-color);\n }\n\n .vs-box.has-v {\n border: 2.5px solid #10b981;\n background: rgba(16, 185, 129, 0.08);\n }\n\n .vs-box.has-v .vs-def {\n display: none;\n }\n\n .vs-ok {\n display: none;\n }\n\n .vs-box.has-v .vs-ok {\n display: flex;\n }\n\n .vs-player {\n position: relative;\n width: 100%;\n background: #000;\n border-radius: 12px;\n overflow: hidden;\n cursor: ew-resize;\n border: 1px solid #444;\n }\n\n .vs-player video {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .v-top {\n z-index: 2;\n }\n\n .v-handle {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 4px;\n margin-left: -2px;\n background: var(--color-accent);\n z-index: 10;\n pointer-events: none;\n }\n\n .v-handle::after {\n content: '\u2194';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 44px;\n height: 44px;\n background: var(--color-accent);\n border-radius: 50%;\n border: 3px solid white;\n color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: bold;\n font-size: 20px;\n box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);\n }\n\n .v-btns {\n position: absolute;\n top: 15px;\n right: 15px;\n z-index: 30;\n display: flex;\n gap: 8px;\n }\n\n .vs-btn,\n .v-btn {\n background: #111 !important;\n border: 2px solid #444;\n border-radius: 10px;\n width: 48px;\n height: 48px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .v-btn svg,\n .vs-btn svg {\n width: 26px;\n height: 26px;\n color: white !important;\n stroke: white !important;\n stroke-width: 2.5px !important;\n }\n\n .v-play-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.3);\n z-index: 20;\n color: white;\n font-size: 60px;\n pointer-events: none;\n opacity: 1;\n transition: 0.2s;\n }\n\n .vs-player.playing .v-play-overlay {\n opacity: 0;\n }\n \"\"\"\n\n js_on_load = f\"\"\"\n const c = element.querySelector('.vs-player');\n if (!c) return;\n const v1 = c.querySelector('.v-base');\n const v2 = c.querySelector('.v-top');\n const h = c.querySelector('.v-handle');\n const bxs = element.querySelectorAll('.vs-box');\n\n const iVol = `{icons['volume']}`;\n const iMute = `{icons['mute']}`;\n const iMax = `{icons['maximize']}`;\n const iMin = `{icons['minimize']}`;\n\n const applyVideos = (data) => {{\n if (data && data.length === 2 && data[0] && data[1]) {{\n v1.src = data[0]; \n v2.src = data[1];\n c.style.display = 'block';\n bxs.forEach(b => b.classList.add('has-v'));\n }}\n }};\n\n const observer = new MutationObserver(() => {{\n try {{\n const newValue = JSON.parse(c.getAttribute('data-value'));\n applyVideos(newValue);\n }} catch(e) {{}}\n }});\n observer.observe(c, {{ attributes: true, attributeFilter: ['data-value'] }});\n\n applyVideos(props.value);\n\n const iL = element.querySelector('#in-l');\n const iR = element.querySelector('#in-r');\n if (iL && iR) {{\n const up = (file, idx) => {{\n const r = new FileReader();\n r.onload = (e) => {{\n const b64 = e.target.result;\n if(idx===0) v1.src = b64; else v2.src = b64;\n bxs[idx].classList.add('has-v');\n if(v1.src && v2.src) {{\n c.style.display = 'block';\n props.value = [v1.src, v2.src];\n trigger('change');\n }}\n }};\n r.readAsDataURL(file);\n }};\n iL.onchange = e => up(e.target.files[0], 0);\n iR.onchange = e => up(e.target.files[0], 1);\n bxs[0].onclick = () => iL.click();\n bxs[1].onclick = () => iR.click();\n }}\n\n const bM = element.querySelector('#btn-mute');\n bM.onclick = e => {{ e.stopPropagation(); v1.muted = !v1.muted; bM.innerHTML = v1.muted ? iMute : iVol; }};\n const bF = element.querySelector('#btn-fs');\n bF.onclick = e => {{ e.stopPropagation(); if(!document.fullscreenElement) c.requestFullscreen(); else document.exitFullscreen(); }};\n document.addEventListener('fullscreenchange', () => {{ bF.innerHTML = document.fullscreenElement ? iMin : iMax; }});\n\n function refresh(p) {{\n p = Math.max(0, Math.min(100, p));\n h.style.left = p + \"%\";\n v2.style.clipPath = `polygon(${{p}}% 0, 100% 0, 100% 100%, ${{p}}% 100%)`;\n }}\n refresh(50);\n\n c.onmousemove = e => {{ if(e.buttons===1) refresh(((e.clientX - c.getBoundingClientRect().left)/c.offsetWidth)*100); }};\n c.onmousedown = e => {{ if(!e.target.closest('button')) refresh(((e.clientX - c.getBoundingClientRect().left)/c.offsetWidth)*100); }};\n c.onclick = e => {{ if(e.target.closest('button')) return; if(v1.paused) v1.play(); else v1.pause(); }};\n v1.onplay = () => {{ v2.currentTime = v1.currentTime; v2.play(); c.classList.add('playing'); }};\n v1.onpause = () => {{ v2.pause(); c.classList.remove('playing'); }};\n v1.ontimeupdate = () => {{ if(Math.abs(v1.currentTime - v2.currentTime) > 0.2) v2.currentTime = v1.currentTime; }};\n \"\"\"\n\n super().__init__(\n value=value,\n html_template=html_template,\n css_template=css_template,\n js_on_load=js_on_load,\n **kwargs\n )\n\n def _encode(self, path):\n if not path or not os.path.exists(path): return None\n mime, _ = mimetypes.guess_type(path)\n with open(path, \"rb\") as f:\n b64 = base64.b64encode(f.read()).decode()\n return f\"data:{mime or 'video/mp4'};base64,{b64}\"\n\n def postprocess(self, value):\n if value and isinstance(value, (list, tuple)) and len(value) == 2:\n return [self._encode(v) for v in value]\n return value\n\n def api_info(self): return {\"type\": \"string\"}\n",
|
| 18 |
+
"head": "",
|
| 19 |
+
"repo_url": "https://huggingface.co/spaces/elismasilva/gradio_video_slider"
|
| 20 |
+
}
|
manifest.json
CHANGED
|
@@ -216,5 +216,17 @@
|
|
| 216 |
"dashboard"
|
| 217 |
],
|
| 218 |
"repo_url": "https://huggingface.co/spaces/elismasilva/gradio_gpu_monitor"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
}
|
| 220 |
]
|
|
|
|
| 216 |
"dashboard"
|
| 217 |
],
|
| 218 |
"repo_url": "https://huggingface.co/spaces/elismasilva/gradio_gpu_monitor"
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"id": "video-slider",
|
| 222 |
+
"name": "Video Slider",
|
| 223 |
+
"description": "A high-performance video comparison component for Gradio apps. It allows users to compare two videos side-by-side with a draggable slider, featuring frame-accurate synchronization and built-in audio/fullscreen controls.",
|
| 224 |
+
"author": "elismasilva",
|
| 225 |
+
"tags": [
|
| 226 |
+
"video",
|
| 227 |
+
"video-comparison",
|
| 228 |
+
"slider"
|
| 229 |
+
],
|
| 230 |
+
"repo_url": "https://huggingface.co/spaces/elismasilva/gradio_video_slider"
|
| 231 |
}
|
| 232 |
]
|