Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -332,7 +332,8 @@ with tab1:
|
|
332 |
|
333 |
st.subheader("Top Predictions & Scores")
|
334 |
if 'results_df' in st.session_state and not st.session_state.results_df.empty:
|
335 |
-
|
|
|
336 |
else:
|
337 |
st.info("No valid predictions to display. Try a different input.")
|
338 |
|
@@ -353,13 +354,19 @@ with tab2:
|
|
353 |
smiles_input_viewer = st.text_input("SMILES String", value="CC(=O)Oc1ccccc1C(=O)O") # Aspirin
|
354 |
viewer_submit = st.form_submit_button("👁️ View Molecule", use_container_width=True)
|
355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
if viewer_submit:
|
357 |
with st.spinner("Generating visualization..."):
|
358 |
html_view, log = visualize_molecule_2d_3d(smiles_input_viewer, "Molecule")
|
359 |
st.session_state.viewer_html = html_view
|
360 |
st.session_state.viewer_log = log
|
361 |
|
362 |
-
if
|
363 |
st.components.v1.html(st.session_state.viewer_html, height=450)
|
364 |
|
365 |
with st.expander("Show Logs"):
|
|
|
332 |
|
333 |
st.subheader("Top Predictions & Scores")
|
334 |
if 'results_df' in st.session_state and not st.session_state.results_df.empty:
|
335 |
+
# FIX: Corrected the typo from 'results__df' to 'results_df'
|
336 |
+
st.dataframe(st.session_state.results_df, use_container_width=True, hide_index=True)
|
337 |
else:
|
338 |
st.info("No valid predictions to display. Try a different input.")
|
339 |
|
|
|
354 |
smiles_input_viewer = st.text_input("SMILES String", value="CC(=O)Oc1ccccc1C(=O)O") # Aspirin
|
355 |
viewer_submit = st.form_submit_button("👁️ View Molecule", use_container_width=True)
|
356 |
|
357 |
+
# Initialize viewer_html in session state if it doesn't exist
|
358 |
+
if 'viewer_html' not in st.session_state:
|
359 |
+
st.session_state.viewer_html = ""
|
360 |
+
st.session_state.viewer_log = "Enter a SMILES string and click 'View Molecule'."
|
361 |
+
|
362 |
+
|
363 |
if viewer_submit:
|
364 |
with st.spinner("Generating visualization..."):
|
365 |
html_view, log = visualize_molecule_2d_3d(smiles_input_viewer, "Molecule")
|
366 |
st.session_state.viewer_html = html_view
|
367 |
st.session_state.viewer_log = log
|
368 |
|
369 |
+
if st.session_state.viewer_html:
|
370 |
st.components.v1.html(st.session_state.viewer_html, height=450)
|
371 |
|
372 |
with st.expander("Show Logs"):
|