alidenewade commited on
Commit
35e900e
·
verified ·
1 Parent(s): cba300d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -554,12 +554,11 @@ with tab1:
554
  st.subheader("Calculated Molecular Properties")
555
  st.dataframe(res1.get('props_df', pd.DataFrame()), use_container_width=True)
556
  with p1_tabs[2]:
557
- st.subheader("Molecular Properties Dashboard")
558
- if res1.get('props_plot'):
559
- # Display the plot and then close it to prevent memory leaks
560
- st.pyplot(res1['props_plot'], clear_figure=True)
561
- # Explicitly close the figure after displaying
562
- plt.close(res1['props_plot'])
563
 
564
  # ===== TAB 2: LEAD GENERATION & OPTIMIZATION =====
565
  with tab2:
@@ -702,12 +701,11 @@ with tab4:
702
  res4 = st.session_state.results_p4
703
  p4_tabs = st.tabs(["Pharmacovigilance Analysis", "Regulatory & Ethical Frameworks"])
704
  with p4_tabs[0]:
705
- st.subheader("Simulated Adverse Event Analysis")
706
- if 'plot_bar' in res4 and res4['plot_bar'] is not None:
707
- st.pyplot(res4['plot_bar'], clear_figure=True)
708
- # Explicitly close the figure after displaying
709
- plt.close(res4['plot_bar'])
710
- st.dataframe(res4['rwd_df'], use_container_width=True)
711
 
712
  with p4_tabs[1]:
713
  col1, col2 = st.columns(2)
@@ -716,4 +714,4 @@ with tab4:
716
  st.dataframe(res4.get('reg_df', pd.DataFrame()), use_container_width=True)
717
  with col2:
718
  st.subheader("Ethical Framework for AI in Healthcare")
719
- st.dataframe(res4.get('eth_df', pd.DataFrame()), use_container_width=True)
 
554
  st.subheader("Calculated Molecular Properties")
555
  st.dataframe(res1.get('props_df', pd.DataFrame()), use_container_width=True)
556
  with p1_tabs[2]:
557
+ st.subheader("Molecular Properties Dashboard")
558
+ if res1.get('props_plot'):
559
+ # Display the plot using clear_figure to manage memory without causing reruns
560
+ st.pyplot(res1['props_plot'], clear_figure=True)
561
+ # FIX: Removed the explicit plt.close() call which caused the flickering
 
562
 
563
  # ===== TAB 2: LEAD GENERATION & OPTIMIZATION =====
564
  with tab2:
 
701
  res4 = st.session_state.results_p4
702
  p4_tabs = st.tabs(["Pharmacovigilance Analysis", "Regulatory & Ethical Frameworks"])
703
  with p4_tabs[0]:
704
+ st.subheader("Simulated Adverse Event Analysis")
705
+ if 'plot_bar' in res4 and res4['plot_bar'] is not None:
706
+ st.pyplot(res4['plot_bar'], clear_figure=True)
707
+ # FIX: Removed the explicit plt.close() call which caused the flickering
708
+ st.dataframe(res4['rwd_df'], use_container_width=True)
 
709
 
710
  with p4_tabs[1]:
711
  col1, col2 = st.columns(2)
 
714
  st.dataframe(res4.get('reg_df', pd.DataFrame()), use_container_width=True)
715
  with col2:
716
  st.subheader("Ethical Framework for AI in Healthcare")
717
+ st.dataframe(res4.get('eth_df', pd.DataFrame()), use_container_width=True)