Spaces:
Sleeping
Sleeping
Youngsun Lim
commited on
Commit
·
69d01ac
1
Parent(s):
2f084b5
no sound
Browse files
app.py
CHANGED
|
@@ -421,7 +421,7 @@ with gr.Blocks(fill_height=True, css=GLOBAL_CSS) as demo:
|
|
| 421 |
with gr.Row():
|
| 422 |
with gr.Column():
|
| 423 |
gr.Markdown("**Expected depiction of action**")
|
| 424 |
-
gr.Video(value=EX_CACHE["BodyWeightSquats"]["real"], height=240, autoplay=False)
|
| 425 |
with gr.Column():
|
| 426 |
gr.Markdown("**Poorly generated action**")
|
| 427 |
gr.Video(value=EX_CACHE["BodyWeightSquats"]["bad"], height=240, autoplay=False)
|
|
@@ -434,13 +434,58 @@ with gr.Blocks(fill_height=True, css=GLOBAL_CSS) as demo:
|
|
| 434 |
with gr.Row():
|
| 435 |
with gr.Column():
|
| 436 |
gr.Markdown("**Expected depiction of action**")
|
| 437 |
-
gr.Video(value=EX_CACHE["WallPushUps"]["real"], height=240, autoplay=False)
|
| 438 |
with gr.Column():
|
| 439 |
gr.Markdown("**Poorly generated action**")
|
| 440 |
gr.Video(value=EX_CACHE["WallPushUps"]["bad"], height=240, autoplay=False)
|
| 441 |
if not (EX_CACHE["WallPushUps"]["real"] and EX_CACHE["WallPushUps"]["bad"]):
|
| 442 |
gr.Markdown("> ⚠️ Upload `examples/WallPushUps_real.mp4` and `_bad.mp4` to show both samples.")
|
| 443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 444 |
understood = gr.Checkbox(label="I have read and understand the task.", value=False)
|
| 445 |
start_btn = gr.Button("Yes, start", variant="secondary", interactive=False)
|
| 446 |
|
|
|
|
| 421 |
with gr.Row():
|
| 422 |
with gr.Column():
|
| 423 |
gr.Markdown("**Expected depiction of action**")
|
| 424 |
+
gr.Video(value=EX_CACHE["BodyWeightSquats"]["real"], height=240, autoplay=False, elem_id="ex_squats_real",)
|
| 425 |
with gr.Column():
|
| 426 |
gr.Markdown("**Poorly generated action**")
|
| 427 |
gr.Video(value=EX_CACHE["BodyWeightSquats"]["bad"], height=240, autoplay=False)
|
|
|
|
| 434 |
with gr.Row():
|
| 435 |
with gr.Column():
|
| 436 |
gr.Markdown("**Expected depiction of action**")
|
| 437 |
+
gr.Video(value=EX_CACHE["WallPushUps"]["real"], height=240, autoplay=False, elem_id="ex_wallpushups_real",)
|
| 438 |
with gr.Column():
|
| 439 |
gr.Markdown("**Poorly generated action**")
|
| 440 |
gr.Video(value=EX_CACHE["WallPushUps"]["bad"], height=240, autoplay=False)
|
| 441 |
if not (EX_CACHE["WallPushUps"]["real"] and EX_CACHE["WallPushUps"]["bad"]):
|
| 442 |
gr.Markdown("> ⚠️ Upload `examples/WallPushUps_real.mp4` and `_bad.mp4` to show both samples.")
|
| 443 |
|
| 444 |
+
gr.HTML("""
|
| 445 |
+
<script>
|
| 446 |
+
(function(){
|
| 447 |
+
const ids = [
|
| 448 |
+
"ex_squats_real",
|
| 449 |
+
"ex_wallpushups_real",
|
| 450 |
+
];
|
| 451 |
+
function muteById(id){
|
| 452 |
+
const host = document.getElementById(id);
|
| 453 |
+
if(!host) return;
|
| 454 |
+
// gr.Video는 Shadow DOM 내부에 <video>가 랜더링됨
|
| 455 |
+
const roots = [host, host.shadowRoot].filter(Boolean);
|
| 456 |
+
roots.forEach(root=>{
|
| 457 |
+
const vids = root.querySelectorAll('video');
|
| 458 |
+
vids.forEach(v=>{
|
| 459 |
+
try{
|
| 460 |
+
v.muted = true;
|
| 461 |
+
v.volume = 0.0;
|
| 462 |
+
v.setAttribute('muted','');
|
| 463 |
+
v.setAttribute('playsinline','');
|
| 464 |
+
// 사용자가 바꿔도 즉시 원복
|
| 465 |
+
if(!v._exMuteHooked){
|
| 466 |
+
v.addEventListener('volumechange', ()=>{
|
| 467 |
+
if(!v.muted || v.volume > 0){ v.muted = true; v.volume = 0.0; }
|
| 468 |
+
});
|
| 469 |
+
v.addEventListener('play', ()=>{
|
| 470 |
+
v.muted = true; v.volume = 0.0;
|
| 471 |
+
});
|
| 472 |
+
v._exMuteHooked = true;
|
| 473 |
+
}
|
| 474 |
+
}catch(e){}
|
| 475 |
+
});
|
| 476 |
+
});
|
| 477 |
+
}
|
| 478 |
+
function apply(){
|
| 479 |
+
ids.forEach(muteById);
|
| 480 |
+
}
|
| 481 |
+
// 초기 + DOM변경 시 적용
|
| 482 |
+
apply();
|
| 483 |
+
new MutationObserver(apply).observe(document, {subtree:true, childList:true});
|
| 484 |
+
})();
|
| 485 |
+
</script>
|
| 486 |
+
""")
|
| 487 |
+
|
| 488 |
+
|
| 489 |
understood = gr.Checkbox(label="I have read and understand the task.", value=False)
|
| 490 |
start_btn = gr.Button("Yes, start", variant="secondary", interactive=False)
|
| 491 |
|