Nguyễn Thành Đạt commited on
Commit
19bd631
·
1 Parent(s): 036e7c4

updateGUI

Browse files
Files changed (1) hide show
  1. app.py +20 -13
app.py CHANGED
@@ -174,19 +174,26 @@ if uploaded_file is not None:
174
 
175
 
176
  exp_html = exp.as_html()
177
- components.html(exp_html, height=1400, width=None)
178
-
179
- # def extract_explain(exp, label):
180
- # ans = exp.local_exp[label]
181
- # ans = [(exp.domain_mapper.feature_names[x[0]],
182
- # exp.domain_mapper.feature_values[x[0]],
183
- # exp.domain_mapper.discretized_feature_names[x[0]],
184
- # float(x[1])
185
- # ) for x in ans]
 
 
 
 
 
 
 
186
 
187
- # return ans
188
 
189
- # explanation_list = extract_explain(exp, predicted)
190
- # explanation_df = pd.DataFrame(explanation_list, columns=['Feature', 'Value', 'Explain', 'Weight'])
191
- # st.table(explanation_df)
192
 
 
174
 
175
 
176
  exp_html = exp.as_html()
177
+ full_html = exp_html + """
178
+ <style>
179
+ div[class="lime explanation"] { display: none; } /* This targets the tree section */
180
+ .lime.table_div {overflow-x: hidden}
181
+ </style>
182
+ """
183
+ components.html(full_html, height=320, width=None, scrolling=True)
184
+
185
+
186
+ def extract_explain(exp, label):
187
+ ans = exp.local_exp[label]
188
+ ans = [(exp.domain_mapper.feature_names[x[0]],
189
+ exp.domain_mapper.feature_values[x[0]],
190
+ exp.domain_mapper.discretized_feature_names[x[0]],
191
+ float(x[1])
192
+ ) for x in ans]
193
 
194
+ return ans
195
 
196
+ explanation_list = extract_explain(exp, predicted)
197
+ explanation_df = pd.DataFrame(explanation_list, columns=['Feature', 'Value', 'Explain', 'Weight'])
198
+ st.table(explanation_df)
199