Spaces:
Sleeping
Sleeping
devjas1
commited on
Commit
·
114376b
1
Parent(s):
6373c5a
(HOTFIX): correct unpacking from 'resample_spectrum' to extract only 'y_resampled' (fixes [2, 500] shape bug)
Browse files
app.py
CHANGED
|
@@ -495,6 +495,7 @@ def main():
|
|
| 495 |
)
|
| 496 |
|
| 497 |
if submitted and inference_ready:
|
|
|
|
| 498 |
try:
|
| 499 |
raw_text = st.session_state["input_text"]
|
| 500 |
filename = st.session_state.get("filename") or "unknown.txt"
|
|
@@ -505,7 +506,7 @@ def main():
|
|
| 505 |
|
| 506 |
# Resample
|
| 507 |
with st.spinner("Resampling spectrum..."):
|
| 508 |
-
y_resampled = resample_spectrum(x_raw, y_raw, TARGET_LEN)
|
| 509 |
|
| 510 |
# Persist results (drives right column)
|
| 511 |
st.session_state["x_raw"] = x_raw
|
|
@@ -541,7 +542,7 @@ def main():
|
|
| 541 |
x_raw, y_raw, y_resampled)
|
| 542 |
st.image(
|
| 543 |
spectrum_plot, caption="Spectrum Preprocessing Results", use_container_width=True)
|
| 544 |
-
except
|
| 545 |
st.warning(f"Could not generate plot: {e}")
|
| 546 |
log_message(f"Plot generation error: {e}")
|
| 547 |
|
|
|
|
| 495 |
)
|
| 496 |
|
| 497 |
if submitted and inference_ready:
|
| 498 |
+
# Handles the submission of the analysis form and performs spectrum data processing
|
| 499 |
try:
|
| 500 |
raw_text = st.session_state["input_text"]
|
| 501 |
filename = st.session_state.get("filename") or "unknown.txt"
|
|
|
|
| 506 |
|
| 507 |
# Resample
|
| 508 |
with st.spinner("Resampling spectrum..."):
|
| 509 |
+
_, y_resampled = resample_spectrum(x_raw, y_raw, TARGET_LEN)
|
| 510 |
|
| 511 |
# Persist results (drives right column)
|
| 512 |
st.session_state["x_raw"] = x_raw
|
|
|
|
| 542 |
x_raw, y_raw, y_resampled)
|
| 543 |
st.image(
|
| 544 |
spectrum_plot, caption="Spectrum Preprocessing Results", use_container_width=True)
|
| 545 |
+
except (ValueError, RuntimeError, TypeError) as e:
|
| 546 |
st.warning(f"Could not generate plot: {e}")
|
| 547 |
log_message(f"Plot generation error: {e}")
|
| 548 |
|