Chidam Gopal commited on
Commit
041cf4e
Β·
unverified Β·
1 Parent(s): 80baa0b

iab classification model updates

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +7 -7
src/streamlit_app.py CHANGED
@@ -93,11 +93,11 @@ def get_data_and_embeddings():
93
 
94
 
95
  st.set_page_config(page_title="IAB Classifier App", layout="wide")
96
- st.title("🧠 IAB Classifier App")
97
 
98
  # Load data
99
  texts, prior_labels, X = get_data_and_embeddings()
100
- st.markdown("### 🧭 Reference sentence for similarity")
101
  reference = st.text_area("Type something like 'business related'")
102
  prediction_choice = st.checkbox("try our iab model prediction for this")
103
 
@@ -135,7 +135,7 @@ if reference:
135
  top_size = st.slider("number of similar items", 1, 100, 5)
136
  top_candidates = [(row["text"], row["sim"], row["label"]) for row in df_emb.to_dict(orient="records")][:top_size]
137
 
138
- st.markdown("### πŸ§ͺ Similar example(s)")
139
  if not top_candidates:
140
  st.info("No more similar examples.")
141
  else:
@@ -149,7 +149,7 @@ if reference:
149
 
150
  # Left: What training data says
151
  with col1:
152
- st.markdown("#### πŸ“š What Training Data Says")
153
  fig1, ax1 = plt.subplots()
154
  top_labelled_df['label'].value_counts(normalize=True).sort_values().plot(kind='barh', ax=ax1, color="lightcoral")
155
  ax1.set_title("Label Distribution")
@@ -159,7 +159,7 @@ if reference:
159
 
160
  # Right: What model predicts
161
  with col2:
162
- st.markdown("#### πŸ€– Model Predictions")
163
  if len(preds) == 0 or not prediction_choice:
164
  st.write("Model is unsure")
165
  else:
@@ -171,7 +171,7 @@ if reference:
171
  st.pyplot(fig2)
172
 
173
  if prediction_choice and reference:
174
- st.markdown("### πŸ” Model Explanation (Top Predicted Class)")
175
 
176
  explainer = get_explainer()
177
  attributions = explainer(reference)
@@ -189,7 +189,7 @@ if prediction_choice and reference:
189
  st.pyplot(fig)
190
 
191
  # HTML Highlighted Text
192
- st.markdown("#### πŸ”Ž Highlighted Text Importance")
193
  html_output = explainer.visualize().data
194
 
195
  # Render in Streamlit
 
93
 
94
 
95
  st.set_page_config(page_title="IAB Classifier App", layout="wide")
96
+ st.title("IAB Classifier App")
97
 
98
  # Load data
99
  texts, prior_labels, X = get_data_and_embeddings()
100
+ st.markdown("### Reference sentence for similarity")
101
  reference = st.text_area("Type something like 'business related'")
102
  prediction_choice = st.checkbox("try our iab model prediction for this")
103
 
 
135
  top_size = st.slider("number of similar items", 1, 100, 5)
136
  top_candidates = [(row["text"], row["sim"], row["label"]) for row in df_emb.to_dict(orient="records")][:top_size]
137
 
138
+ st.markdown("### Similar example(s)")
139
  if not top_candidates:
140
  st.info("No more similar examples.")
141
  else:
 
149
 
150
  # Left: What training data says
151
  with col1:
152
+ st.markdown("#### What Training Data Says")
153
  fig1, ax1 = plt.subplots()
154
  top_labelled_df['label'].value_counts(normalize=True).sort_values().plot(kind='barh', ax=ax1, color="lightcoral")
155
  ax1.set_title("Label Distribution")
 
159
 
160
  # Right: What model predicts
161
  with col2:
162
+ st.markdown("#### Model Predictions")
163
  if len(preds) == 0 or not prediction_choice:
164
  st.write("Model is unsure")
165
  else:
 
171
  st.pyplot(fig2)
172
 
173
  if prediction_choice and reference:
174
+ st.markdown("### Model Explanation (Top Predicted Class)")
175
 
176
  explainer = get_explainer()
177
  attributions = explainer(reference)
 
189
  st.pyplot(fig)
190
 
191
  # HTML Highlighted Text
192
+ st.markdown("#### Highlighted Text Importance")
193
  html_output = explainer.visualize().data
194
 
195
  # Render in Streamlit