Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,24 +59,13 @@ def load_all_assets(key: str) -> Dict:
|
|
| 59 |
|
| 60 |
# --- UI LOGIC ---
|
| 61 |
|
| 62 |
-
def
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
for f, count in families.items():
|
| 70 |
-
fam_table += f"| {f.upper()} | {count} | Synthetic {f} circuits |\n"
|
| 71 |
-
|
| 72 |
-
return f"""
|
| 73 |
-
## 📖 Methodology: {meta.get('dataset_version')}
|
| 74 |
-
**Generator:** QSBench v{meta.get('generator_version')}
|
| 75 |
-
**Config:** {params.get('n_qubits')} Qubits | Depth {params.get('depth')} | Noise `{params.get('noise')}` (p={params.get('noise_prob')})
|
| 76 |
-
|
| 77 |
-
### Circuit Family Coverage
|
| 78 |
-
{fam_table}
|
| 79 |
-
"""
|
| 80 |
|
| 81 |
def sync_ml_metrics(ds_name: str):
|
| 82 |
"""Dynamically finds all available numerical metrics (features) from CSV/Dataset"""
|
|
@@ -176,8 +165,8 @@ with gr.Blocks(theme=gr.themes.Soft(), title="QSBench Hub") as demo:
|
|
| 176 |
t_out = gr.Markdown()
|
| 177 |
|
| 178 |
with gr.TabItem("📖 Methodology"):
|
| 179 |
-
|
| 180 |
-
meth_md = gr.Markdown()
|
| 181 |
|
| 182 |
gr.Markdown(f"""
|
| 183 |
---
|
|
@@ -193,13 +182,9 @@ with gr.Blocks(theme=gr.themes.Soft(), title="QSBench Hub") as demo:
|
|
| 193 |
ml_ds_sel.change(sync_ml_metrics, [ml_ds_sel], [ml_feat_sel])
|
| 194 |
train_btn.click(train_model, [ml_ds_sel, ml_feat_sel], [p_out, t_out])
|
| 195 |
|
| 196 |
-
# Methodology
|
| 197 |
-
meth_ds_sel.change(get_methodology_content, [meth_ds_sel], [meth_md])
|
| 198 |
-
|
| 199 |
# Initial Load
|
| 200 |
demo.load(update_explorer, [ds_sel, sp_sel], [sp_sel, data_view, c_raw, c_tr, meta_txt])
|
| 201 |
demo.load(sync_ml_metrics, [ml_ds_sel], [ml_feat_sel])
|
| 202 |
-
demo.load(get_methodology_content, [meth_ds_sel], [meth_md])
|
| 203 |
|
| 204 |
if __name__ == "__main__":
|
| 205 |
demo.launch()
|
|
|
|
| 59 |
|
| 60 |
# --- UI LOGIC ---
|
| 61 |
|
| 62 |
+
def load_guide_content():
|
| 63 |
+
"""Reads the content of GUIDE.md from the local directory."""
|
| 64 |
+
try:
|
| 65 |
+
with open("GUIDE.md", "r", encoding="utf-8") as f:
|
| 66 |
+
return f.read()
|
| 67 |
+
except FileNotFoundError:
|
| 68 |
+
return "### ⚠️ Error: GUIDE.md not found. Please ensure it is in the root directory."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
def sync_ml_metrics(ds_name: str):
|
| 71 |
"""Dynamically finds all available numerical metrics (features) from CSV/Dataset"""
|
|
|
|
| 165 |
t_out = gr.Markdown()
|
| 166 |
|
| 167 |
with gr.TabItem("📖 Methodology"):
|
| 168 |
+
# Automatically loads content from GUIDE.md
|
| 169 |
+
meth_md = gr.Markdown(value=load_guide_content())
|
| 170 |
|
| 171 |
gr.Markdown(f"""
|
| 172 |
---
|
|
|
|
| 182 |
ml_ds_sel.change(sync_ml_metrics, [ml_ds_sel], [ml_feat_sel])
|
| 183 |
train_btn.click(train_model, [ml_ds_sel, ml_feat_sel], [p_out, t_out])
|
| 184 |
|
|
|
|
|
|
|
|
|
|
| 185 |
# Initial Load
|
| 186 |
demo.load(update_explorer, [ds_sel, sp_sel], [sp_sel, data_view, c_raw, c_tr, meta_txt])
|
| 187 |
demo.load(sync_ml_metrics, [ml_ds_sel], [ml_feat_sel])
|
|
|
|
| 188 |
|
| 189 |
if __name__ == "__main__":
|
| 190 |
demo.launch()
|