ferdmartin commited on
Commit
f6644ad
Β·
1 Parent(s): 0c09fe8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -107,9 +107,11 @@ def main():
107
  st.header("Is it human-made πŸ“ or Generated with AI πŸ€– ? ")
108
 
109
  # Check the model to use
110
- option = st.selectbox("Select a model to use:", models_available)
111
- if option and "prediction" in st.session_state:
112
- del st.session_state.prediction
 
 
113
 
114
  # Load the selected trained model
115
  if option in ("BERT-based model", "DistilBERT-based model (BERT light)"):
@@ -160,7 +162,7 @@ def main():
160
 
161
  if st.button("Model Explanation"):
162
  # Check if there's text in the session state
163
- if "text" in st.session_state:
164
 
165
  if option in ("Naive Bayes", "Logistic Regression"):
166
  with st.spinner('Wait for it πŸ’­...'):
 
107
  st.header("Is it human-made πŸ“ or Generated with AI πŸ€– ? ")
108
 
109
  # Check the model to use
110
+ def restore_prediction_state():
111
+ if "prediction" in st.session_state:
112
+ del st.session_state.prediction
113
+ option = st.selectbox("Select a model to use:", models_available, on_change=restore_prediction_state)
114
+
115
 
116
  # Load the selected trained model
117
  if option in ("BERT-based model", "DistilBERT-based model (BERT light)"):
 
162
 
163
  if st.button("Model Explanation"):
164
  # Check if there's text in the session state
165
+ if "text" in st.session_state and "prediction" in st.session_state:
166
 
167
  if option in ("Naive Bayes", "Logistic Regression"):
168
  with st.spinner('Wait for it πŸ’­...'):