Spaces:
Running
Running
fix combobox of examples
Browse files- app.py +4 -0
- static/s2f_styles.css +7 -2
app.py
CHANGED
|
@@ -462,6 +462,7 @@ if just_ran_batch:
|
|
| 462 |
st.session_state["prediction_result"] = None
|
| 463 |
st.session_state["batch_results"] = None
|
| 464 |
with st.spinner("Loading model and predicting..."):
|
|
|
|
| 465 |
try:
|
| 466 |
predictor = _load_predictor(model_type, checkpoint, ckp_folder)
|
| 467 |
sub_val = substrate_val if model_type == "single_cell" and not use_manual else DEFAULT_SUBSTRATE
|
|
@@ -490,6 +491,7 @@ if just_ran_batch:
|
|
| 490 |
for (img_b, key_b), (heatmap, force, pixel_sum) in zip(imgs_batch, pred_results)
|
| 491 |
]
|
| 492 |
st.session_state["batch_results"] = batch_results
|
|
|
|
| 493 |
st.success(f"Prediction complete for {len(batch_results)} image(s)!")
|
| 494 |
render_batch_results(
|
| 495 |
batch_results,
|
|
@@ -503,6 +505,8 @@ if just_ran_batch:
|
|
| 503 |
clip_bounds=clip_bounds,
|
| 504 |
)
|
| 505 |
except Exception as e:
|
|
|
|
|
|
|
| 506 |
st.error(f"Prediction failed: {e}")
|
| 507 |
st.code(traceback.format_exc())
|
| 508 |
|
|
|
|
| 462 |
st.session_state["prediction_result"] = None
|
| 463 |
st.session_state["batch_results"] = None
|
| 464 |
with st.spinner("Loading model and predicting..."):
|
| 465 |
+
progress_bar = None
|
| 466 |
try:
|
| 467 |
predictor = _load_predictor(model_type, checkpoint, ckp_folder)
|
| 468 |
sub_val = substrate_val if model_type == "single_cell" and not use_manual else DEFAULT_SUBSTRATE
|
|
|
|
| 491 |
for (img_b, key_b), (heatmap, force, pixel_sum) in zip(imgs_batch, pred_results)
|
| 492 |
]
|
| 493 |
st.session_state["batch_results"] = batch_results
|
| 494 |
+
progress_bar.empty()
|
| 495 |
st.success(f"Prediction complete for {len(batch_results)} image(s)!")
|
| 496 |
render_batch_results(
|
| 497 |
batch_results,
|
|
|
|
| 505 |
clip_bounds=clip_bounds,
|
| 506 |
)
|
| 507 |
except Exception as e:
|
| 508 |
+
if progress_bar is not None:
|
| 509 |
+
progress_bar.empty()
|
| 510 |
st.error(f"Prediction failed: {e}")
|
| 511 |
st.code(traceback.format_exc())
|
| 512 |
|
static/s2f_styles.css
CHANGED
|
@@ -409,11 +409,16 @@ div[data-testid="stHorizontalBlock"]:has([data-testid="stDownloadButton"]):has([
|
|
| 409 |
/* === Selectbox, multiselect, toggle === */
|
| 410 |
[data-testid="stSelectbox"] > div > div,
|
| 411 |
[data-testid="stSelectbox"] input,
|
| 412 |
-
[data-testid="stMultiSelect"] > div > div
|
| 413 |
-
[data-testid="stMultiSelect"] input {
|
| 414 |
color: #1e293b !important;
|
| 415 |
background-color: #ffffff !important;
|
| 416 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
[data-testid="stSelectbox"] > div > div,
|
| 418 |
[data-testid="stMultiSelect"] > div > div {
|
| 419 |
border-radius: 8px !important;
|
|
|
|
| 409 |
/* === Selectbox, multiselect, toggle === */
|
| 410 |
[data-testid="stSelectbox"] > div > div,
|
| 411 |
[data-testid="stSelectbox"] input,
|
| 412 |
+
[data-testid="stMultiSelect"] > div > div {
|
|
|
|
| 413 |
color: #1e293b !important;
|
| 414 |
background-color: #ffffff !important;
|
| 415 |
}
|
| 416 |
+
/* Multiselect input: transparent so it doesn't show as a white block before the tags */
|
| 417 |
+
[data-testid="stMultiSelect"] input {
|
| 418 |
+
background-color: transparent !important;
|
| 419 |
+
color: #1e293b !important;
|
| 420 |
+
min-width: 2ch !important;
|
| 421 |
+
}
|
| 422 |
[data-testid="stSelectbox"] > div > div,
|
| 423 |
[data-testid="stMultiSelect"] > div > div {
|
| 424 |
border-radius: 8px !important;
|