Spaces:
Sleeping
Sleeping
fix: gr.Image type=filepath for reward_curve + comparison
Browse files
app.py
CHANGED
|
@@ -95,12 +95,16 @@ def run_prompt(task_id: str, system_prompt: str) -> Tuple[str, str, str]:
|
|
| 95 |
|
| 96 |
def load_reward_curve_image() -> str | None:
|
| 97 |
p = Path(__file__).resolve().parent / "docs" / "reward_curve.png"
|
| 98 |
-
|
|
|
|
|
|
|
| 99 |
|
| 100 |
|
| 101 |
def load_comparison_image() -> str | None:
|
| 102 |
p = Path(__file__).resolve().parent / "docs" / "baseline_comparison.png"
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
|
| 105 |
|
| 106 |
def load_comparison_table() -> str:
|
|
@@ -187,7 +191,7 @@ with gr.Blocks(title="PromptOps Arena", theme=gr.themes.Soft()) as demo:
|
|
| 187 |
gr.Markdown("### GRPO training reward curve\n"
|
| 188 |
"Each point is the env's total reward for one rollout during training.")
|
| 189 |
rc_img = gr.Image(value=load_reward_curve_image(), label="reward_curve.png",
|
| 190 |
-
interactive=False, show_label=False)
|
| 191 |
gr.Markdown(
|
| 192 |
"_If this is empty, training hasn't been run yet or `docs/reward_curve.png` "
|
| 193 |
"is missing. Run `scripts/plot_results.py` after training._"
|
|
@@ -196,7 +200,7 @@ with gr.Blocks(title="PromptOps Arena", theme=gr.themes.Soft()) as demo:
|
|
| 196 |
with gr.Tab("Baselines vs trained agent"):
|
| 197 |
gr.Markdown("### Comparison on the held-out test split\n")
|
| 198 |
cmp_img = gr.Image(value=load_comparison_image(), label="baseline_comparison.png",
|
| 199 |
-
interactive=False, show_label=False)
|
| 200 |
gr.Markdown(load_comparison_table())
|
| 201 |
|
| 202 |
with gr.Tab("How it works"):
|
|
|
|
| 95 |
|
| 96 |
def load_reward_curve_image() -> str | None:
|
| 97 |
p = Path(__file__).resolve().parent / "docs" / "reward_curve.png"
|
| 98 |
+
exists = p.exists()
|
| 99 |
+
print(f"[app] reward_curve.png path={p} exists={exists}")
|
| 100 |
+
return str(p) if exists else None
|
| 101 |
|
| 102 |
|
| 103 |
def load_comparison_image() -> str | None:
|
| 104 |
p = Path(__file__).resolve().parent / "docs" / "baseline_comparison.png"
|
| 105 |
+
exists = p.exists()
|
| 106 |
+
print(f"[app] baseline_comparison.png path={p} exists={exists}")
|
| 107 |
+
return str(p) if exists else None
|
| 108 |
|
| 109 |
|
| 110 |
def load_comparison_table() -> str:
|
|
|
|
| 191 |
gr.Markdown("### GRPO training reward curve\n"
|
| 192 |
"Each point is the env's total reward for one rollout during training.")
|
| 193 |
rc_img = gr.Image(value=load_reward_curve_image(), label="reward_curve.png",
|
| 194 |
+
type="filepath", interactive=False, show_label=False)
|
| 195 |
gr.Markdown(
|
| 196 |
"_If this is empty, training hasn't been run yet or `docs/reward_curve.png` "
|
| 197 |
"is missing. Run `scripts/plot_results.py` after training._"
|
|
|
|
| 200 |
with gr.Tab("Baselines vs trained agent"):
|
| 201 |
gr.Markdown("### Comparison on the held-out test split\n")
|
| 202 |
cmp_img = gr.Image(value=load_comparison_image(), label="baseline_comparison.png",
|
| 203 |
+
type="filepath", interactive=False, show_label=False)
|
| 204 |
gr.Markdown(load_comparison_table())
|
| 205 |
|
| 206 |
with gr.Tab("How it works"):
|