rajistics commited on
Commit
b62442e
1 Parent(s): c7add9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -51
app.py CHANGED
@@ -81,57 +81,6 @@ if cls_explainer.accepts_position_ids:
81
  else:
82
  emb_type_num = 0
83
 
84
- explanation_classes = ["predicted"] + list(model.config.label2id.keys())
85
- explanation_class_choice = st.sidebar.selectbox(
86
- "Explanation class: The class you would like to explain output with respect to.",
87
- explanation_classes,
88
- )
89
- my_expander = st.beta_expander(
90
- "Click here for a description of models and their tasks"
91
- )
92
- with my_expander:
93
- st.json(models)
94
-
95
- # st.info("Max char limit of 350 (memory management)")
96
- text = st.text_area(
97
- "Enter text to be interpreted",
98
- "I like you, I love you",
99
- height=400,
100
- max_chars=850,
101
- )
102
- print ("Before button")
103
- if st.button('Say hello'):
104
- st.write('Why hello there')
105
- else:
106
- st.write('Goodbye')
107
- print ("After test button")
108
 
109
- if st.button("Interpret Text"):
110
- #print_memory_usage()
111
- st.text("Output")
112
- with st.spinner("Interpreting your text (This may take some time)"):
113
- print ("Interpreting text")
114
- if explanation_class_choice != "predicted":
115
- word_attributions = cls_explainer(
116
- text,
117
- class_name=explanation_class_choice,
118
- embedding_type=emb_type_num,
119
- internal_batch_size=2,
120
- )
121
- else:
122
- word_attributions = cls_explainer(
123
- text, embedding_type=emb_type_num, internal_batch_size=2
124
- )
125
 
126
- if word_attributions:
127
- print ("Word Attributions")
128
- word_attributions_expander = st.beta_expander(
129
- "Click here for raw word attributions"
130
- )
131
- with word_attributions_expander:
132
- st.json(word_attributions)
133
- components.v1.html(
134
- cls_explainer.visualize()._repr_html_(), scrolling=True, height=350
135
- )
136
- print ("end of stuff")
137
  print ("end of total file")
 
81
  else:
82
  emb_type_num = 0
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
 
 
 
 
 
 
 
 
 
 
 
86
  print ("end of total file")