import gradio as gr import app_v1 import app_v2 MODE_HELP = ( "Pick a demo mode below. " "v2 generates a prediction-only rollout: it seeds the model with the first s frames (max 16) and rolls out N total frames. " "v1 compares prediction vs ground truth over the full sequence and reports relative L2 error over time. " "See the Space README for details." ) # Build Interfaces OUTSIDE the parent Blocks context (prevents double-render) iface_v2 = app_v2.build_demo() iface_v1 = app_v1.build_demo() with gr.Blocks(title="Time-Dependent DeepONet – FPO Rollout Demo") as demo: gr.Markdown("## Time-Dependent DeepONet – FPO Rollout Demo") gr.Markdown(MODE_HELP) with gr.Tabs(): with gr.Tab("v2 — Prediction-only rollout"): iface_v2.render() with gr.Tab("v1 — GT comparison + metrics"): iface_v1.render() if __name__ == "__main__": demo.queue().launch(ssr_mode=False)