Hellisotherpeople
commited on
Commit
•
d9d7c0c
1
Parent(s):
6a26ae8
Update app.py
Browse files
app.py
CHANGED
@@ -212,7 +212,7 @@ form_explainer.form_submit_button("Submit")
|
|
212 |
|
213 |
te = TextExplainer(random_state=42, char_based=char_based, n_samples = number_samples, position_dependent=position_dep)
|
214 |
|
215 |
-
@st.cache(allow_output_mutation=True)
|
216 |
def fit_text_explainer(X, predict_proba):
|
217 |
te.fit(X, predict_proba)
|
218 |
return te
|
@@ -220,8 +220,8 @@ def fit_text_explainer(X, predict_proba):
|
|
220 |
input_choice = st.checkbox("Check this if you want to enter your own example to explain", value = False)
|
221 |
if input_choice == False:
|
222 |
record_to_explain = st.number_input("Enter the index of the document from the original dataset to interpret", value = 30)
|
223 |
-
|
224 |
-
te = fit_text_explainer(df[column_name][record_to_explain], text_clf.predict_proba)
|
225 |
if task == "Classification":
|
226 |
st.write("Ground truth label")
|
227 |
st.write(df[labels_column_name][record_to_explain])
|
@@ -236,8 +236,8 @@ if input_choice == False:
|
|
236 |
st.write(model_prediction)
|
237 |
else:
|
238 |
record_to_explain = st.text_area("Enter the example document to explain", value = text_example)
|
239 |
-
|
240 |
-
te = fit_text_explainer(record_to_explain, text_clf.predict_proba)
|
241 |
if task == "Classification":
|
242 |
st.write("Model prediction")
|
243 |
model_prediction = text_clf.predict([record_to_explain])
|
|
|
212 |
|
213 |
te = TextExplainer(random_state=42, char_based=char_based, n_samples = number_samples, position_dependent=position_dep)
|
214 |
|
215 |
+
@st.cache(allow_output_mutation=True) ##Seems to break shit :(
|
216 |
def fit_text_explainer(X, predict_proba):
|
217 |
te.fit(X, predict_proba)
|
218 |
return te
|
|
|
220 |
input_choice = st.checkbox("Check this if you want to enter your own example to explain", value = False)
|
221 |
if input_choice == False:
|
222 |
record_to_explain = st.number_input("Enter the index of the document from the original dataset to interpret", value = 30)
|
223 |
+
te.fit(df[column_name][record_to_explain], text_clf.predict_proba)
|
224 |
+
#te = fit_text_explainer(df[column_name][record_to_explain], text_clf.predict_proba)
|
225 |
if task == "Classification":
|
226 |
st.write("Ground truth label")
|
227 |
st.write(df[labels_column_name][record_to_explain])
|
|
|
236 |
st.write(model_prediction)
|
237 |
else:
|
238 |
record_to_explain = st.text_area("Enter the example document to explain", value = text_example)
|
239 |
+
te.fit(record_to_explain, text_clf.predict_proba)
|
240 |
+
#te = fit_text_explainer(record_to_explain, text_clf.predict_proba)
|
241 |
if task == "Classification":
|
242 |
st.write("Model prediction")
|
243 |
model_prediction = text_clf.predict([record_to_explain])
|