| import gradio as gr |
| import subprocess |
| import os |
|
|
| def run_sample_trial(): |
| |
| if not os.path.exists("candidates.jsonl"): |
| return "Error: Sample dataset 'candidates.jsonl' is missing from the container." |
| |
| yield "Initializing Docker Container Sandbox Env...\nSpawning pipeline subprocess...\n\n" |
| |
| |
| |
| process = subprocess.Popen( |
| [ |
| "python", "run_pipeline.py", |
| "--candidates", "candidates.jsonl", |
| "--ranker", "regressor_no_prescore.pkl" |
| ], |
| stdout=subprocess.PIPE, |
| stderr=subprocess.STDOUT, |
| text=True |
| ) |
|
|
| |
| |
| output_log = "" |
| for line in process.stdout: |
| output_log += line |
| yield output_log |
|
|
| |
| with gr.Blocks(title="Redrob Ranker Sandbox") as demo: |
| gr.Markdown("# 🚀 Redrob Candidate Ranking Pipeline Sandbox") |
| gr.Markdown("Click the button below to execute the end-to-end processing pipeline on a sample data subset inside this container terminal.") |
| |
| run_btn = gr.Button("▶ Run Pipeline Trial", variant="primary") |
| console_output = gr.Textbox(label="Terminal Live Output Logs", lines=22, max_lines=30, interactive=False) |
| |
| run_btn.click(fn=run_sample_trial, outputs=console_output) |
|
|
| |
| demo.queue().launch(server_name="0.0.0.0", server_port=7860) |
|
|