code: def explanation_text(parts, attribution_scores):
      importance = np.zeros(len(parts))
      for feat_idx, coef in attribution_scores:
          importance[feat_idx] = coef
  
      importance_normalized = importance / (
          np.max(np.abs(importance)) + 1e-10
      )
      explanation_text = []
  
      for feat_idx in range(len(parts)):
          color = get_color(importance_normalized[feat_idx])
          coef = importance[feat_idx]
          ngram_text = parts[feat_idx]
          ngram_text = ngram_text.replace("\n", "<br>")
          if np.isclose(coef, 0):
              explanation_text.append(
                  f'<span style="color:#000000;font-size:16px;border-radius:2%;">{ngram_text}</span>'
              )
  
          else:
              explanation_text.append(
                  f'<span style="background-color:{color};color:#000000;'
                  f'font-size:16px;border-radius:2%;">{ngram_text} '
                  f"({coef:.2f})</span>"
              )
  
      explanation_text = " ".join(explanation_text)
      return explanation_text
  
file_path: interpret-text/python/interpret_text/generative/model_lib/streamlit_frontend.py
imports: import streamlit
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: explanation_text(parts, attribution_scores) and returns: explanation_text