Spaces:
Running on Zero
Running on Zero
Constrain generated rollout display size
Browse files
app.py
CHANGED
|
@@ -539,6 +539,20 @@ def _latest_mp4_since(start_time: float) -> Path | None:
|
|
| 539 |
return candidates[0] if candidates else None
|
| 540 |
|
| 541 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 542 |
@spaces.GPU(duration=120)
|
| 543 |
def run_inference(
|
| 544 |
setting: str,
|
|
@@ -578,7 +592,7 @@ def run_inference(
|
|
| 578 |
return str(mp4), _tail(log + f"\nGenerated video: {mp4.relative_to(ROOT)}")
|
| 579 |
|
| 580 |
|
| 581 |
-
with gr.Blocks(title="PhysFormer") as demo:
|
| 582 |
gr.Markdown(
|
| 583 |
"""
|
| 584 |
# PhysFormer Minimal ZeroGPU Demo
|
|
@@ -630,7 +644,7 @@ with gr.Blocks(title="PhysFormer") as demo:
|
|
| 630 |
height=420,
|
| 631 |
)
|
| 632 |
run_button = gr.Button("Generate", variant="primary")
|
| 633 |
-
video = gr.Video(label="Generated rollout", height=
|
| 634 |
log = gr.Textbox(label="Log", lines=18)
|
| 635 |
|
| 636 |
setting.change(
|
|
|
|
| 539 |
return candidates[0] if candidates else None
|
| 540 |
|
| 541 |
|
| 542 |
+
DEMO_CSS = """
|
| 543 |
+
#generated-rollout {
|
| 544 |
+
width: min(100%, 420px) !important;
|
| 545 |
+
max-width: 420px !important;
|
| 546 |
+
}
|
| 547 |
+
|
| 548 |
+
#generated-rollout video {
|
| 549 |
+
width: 100% !important;
|
| 550 |
+
max-height: 240px !important;
|
| 551 |
+
object-fit: contain !important;
|
| 552 |
+
}
|
| 553 |
+
"""
|
| 554 |
+
|
| 555 |
+
|
| 556 |
@spaces.GPU(duration=120)
|
| 557 |
def run_inference(
|
| 558 |
setting: str,
|
|
|
|
| 592 |
return str(mp4), _tail(log + f"\nGenerated video: {mp4.relative_to(ROOT)}")
|
| 593 |
|
| 594 |
|
| 595 |
+
with gr.Blocks(title="PhysFormer", css=DEMO_CSS) as demo:
|
| 596 |
gr.Markdown(
|
| 597 |
"""
|
| 598 |
# PhysFormer Minimal ZeroGPU Demo
|
|
|
|
| 644 |
height=420,
|
| 645 |
)
|
| 646 |
run_button = gr.Button("Generate", variant="primary")
|
| 647 |
+
video = gr.Video(label="Generated rollout", height=240, width=420, elem_id="generated-rollout")
|
| 648 |
log = gr.Textbox(label="Log", lines=18)
|
| 649 |
|
| 650 |
setting.change(
|