File size: 1,239 Bytes
3325388
 
 
539c11b
 
 
535e4d9
 
 
 
3325388
535e4d9
 
 
 
539c11b
 
535e4d9
3325388
535e4d9
 
 
 
 
 
 
 
 
 
539c11b
 
535e4d9
 
 
 
 
 
 
 
539c11b
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import annotations

import json
from pathlib import Path
import gradio as gr

ROOT = Path(__file__).resolve().parent
RESULTS_PATH = ROOT / "evidence" / "results.json"
PROVENANCE_PATH = ROOT / "evidence" / "provenance.json"


def load_data():
    results = json.loads(RESULTS_PATH.read_text(encoding="utf-8"))
    provenance = json.loads(PROVENANCE_PATH.read_text(encoding="utf-8"))
    return results, provenance


results, provenance = load_data()

with gr.Blocks(title="Know More, Know Clearer Reproduction") as demo:
    gr.Markdown(
        f"# {results['title']}\n\n"
        f"**Paper ID**: `{results['paper_id']}` | **Execution**: `{provenance['execution_environment']}` | **API Cost**: `${provenance['actual_api_cost_usd']:.2f}`\n\n"
        f"**Upstream Revision**: `{results['upstream_revision']}`\n"
    )

    claims_data = [
        [c["claim"], c["status"], c["observation"]]
        for c in results["target_claims"]
    ]

    gr.Dataframe(
        headers=["Target Claim", "Status", "Observation"],
        value=claims_data,
        wrap=True,
        interactive=False,
    )

    gr.JSON(value=results.get("metrics", {}), label="Metrics & Statistical Fit")

if __name__ == "__main__":
    demo.launch()