| from pathlib import Path |
|
|
| import gradio as gr |
| import yaml |
|
|
|
|
| PROJECT_ROOT = Path(__file__).resolve().parent |
|
|
|
|
| def list_configs() -> list[str]: |
| return sorted(str(path.relative_to(PROJECT_ROOT)).replace("\\", "/") for path in PROJECT_ROOT.glob("configs/**/*.yaml")) |
|
|
|
|
| def show_config(config_name: str) -> str: |
| if not config_name: |
| return "Select a config." |
| path = PROJECT_ROOT / config_name |
| data = yaml.safe_load(path.read_text(encoding="utf-8")) |
| return yaml.safe_dump(data, sort_keys=False) |
|
|
|
|
| with gr.Blocks(title="DIPAug Project Hub") as demo: |
| gr.Markdown( |
| """ |
| # DIPAug Project Hub |
| |
| **Project Title** |
| |
| Realistic Digital Image Processing-Driven Data Augmentation for Robust Wheat Leaf Disease Classification and Severity Scoring in Field Conditions |
| |
| **Short Titles** |
| |
| - `DIPAug-Net` |
| - `DIPAug-SeverNet` |
| |
| This Hugging Face app is a lightweight dashboard for the project scaffold. It helps inspect the experiment configs and repository structure before training on a proper GPU machine. |
| """ |
| ) |
|
|
| with gr.Row(): |
| with gr.Column(scale=2): |
| config_input = gr.Dropdown(label="Experiment Config", choices=list_configs(), value="configs/phase1/e6_full.yaml") |
| config_output = gr.Code(label="YAML", language="yaml", value=show_config("configs/phase1/e6_full.yaml")) |
| with gr.Column(scale=2): |
| gr.Markdown( |
| """ |
| ## Included Modules |
| |
| - `dipauglib.transforms`: 8 physics-aware augmentations |
| - `dipauglib.schedulers`: adaptive augmentation scheduler |
| - `dipauglib.sampling`: class-imbalance-aware sampling |
| - `dipaugnet`: phase 1 classification pipeline |
| - `dipaugsevernet`: phase 2 segmentation and severity scaffold |
| |
| ## Status |
| |
| - repository scaffold: ready |
| - configs: ready |
| - tests: included |
| - full training runs: not executed in this dashboard |
| """ |
| ) |
|
|
| config_input.change(fn=show_config, inputs=[config_input], outputs=[config_output]) |
|
|
|
|
| if __name__ == "__main__": |
| demo.launch() |
|
|