AIEcosystem commited on
Commit
b3a6a4d
·
verified ·
1 Parent(s): 2783c81

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +9 -6
src/streamlit_app.py CHANGED
@@ -51,6 +51,9 @@ FIXED_CATEGORY_MAPPING = {
51
  }
52
  REVERSE_FIXED_CATEGORY_MAPPING = {label: category for category, label_list in FIXED_CATEGORY_MAPPING.items() for label in label_list}
53
 
 
 
 
54
  # --- Dynamic Color Generator for Custom Labels ---
55
  COLOR_PALETTE = cycle(px.colors.qualitative.Alphabet)
56
 
@@ -541,7 +544,9 @@ if 'results_df' not in st.session_state: st.session_state.results_df = pd.DataFr
541
  if 'elapsed_time' not in st.session_state: st.session_state.elapsed_time = 0.0
542
  if 'topic_results' not in st.session_state: st.session_state.topic_results = None
543
  if 'my_text_area' not in st.session_state: st.session_state.my_text_area = DEFAULT_TEXT
544
- if 'custom_labels_input' not in st.session_state: st.session_state.custom_labels_input = ""
 
 
545
  if 'active_labels_list' not in st.session_state: st.session_state.active_labels_list = FIXED_LABELS
546
  if 'is_custom_mode' not in st.session_state: st.session_state.is_custom_mode = False
547
  if 'num_topics_slider' not in st.session_state: st.session_state.num_topics_slider = 5
@@ -569,14 +574,12 @@ text = st.text_area(
569
  word_count = len(text.split())
570
  st.markdown(f"**Word count:** {word_count}/{word_limit}")
571
 
572
- # --- Custom Labels Input ---
573
  custom_labels_text = st.text_area(
574
- "**Optional:** Enter your own comma-separated entity labels here (e.g., `product, symptom, client_id`). Leave blank for default labels.",
575
  height=60,
576
  key='custom_labels_input',
577
- # --- UPDATED PLACEHOLDER ENTITIES ---
578
- placeholder="e.g., product_name, medical_symptom, customer_id, location_code, internal_project"
579
- # --- END UPDATE ---
580
  )
581
 
582
  col_results, col_clear = st.columns([1, 1])
 
51
  }
52
  REVERSE_FIXED_CATEGORY_MAPPING = {label: category for category, label_list in FIXED_CATEGORY_MAPPING.items() for label in label_list}
53
 
54
+ # --- Default Custom Labels (New Requirement) ---
55
+ DEFAULT_CUSTOM_LABELS = "product_name, medical_symptom, customer_id, internal_project"
56
+
57
  # --- Dynamic Color Generator for Custom Labels ---
58
  COLOR_PALETTE = cycle(px.colors.qualitative.Alphabet)
59
 
 
544
  if 'elapsed_time' not in st.session_state: st.session_state.elapsed_time = 0.0
545
  if 'topic_results' not in st.session_state: st.session_state.topic_results = None
546
  if 'my_text_area' not in st.session_state: st.session_state.my_text_area = DEFAULT_TEXT
547
+ # --- UPDATED: Pre-populate custom labels input ---
548
+ if 'custom_labels_input' not in st.session_state: st.session_state.custom_labels_input = DEFAULT_CUSTOM_LABELS
549
+ # --- END UPDATED ---
550
  if 'active_labels_list' not in st.session_state: st.session_state.active_labels_list = FIXED_LABELS
551
  if 'is_custom_mode' not in st.session_state: st.session_state.is_custom_mode = False
552
  if 'num_topics_slider' not in st.session_state: st.session_state.num_topics_slider = 5
 
574
  word_count = len(text.split())
575
  st.markdown(f"**Word count:** {word_count}/{word_limit}")
576
 
577
+ # --- Custom Labels Input (Now Pre-populated and Editable) ---
578
  custom_labels_text = st.text_area(
579
+ "**Optional:** Edit the comma-separated entity labels below to define your own categories. Delete existing labels or add new ones.",
580
  height=60,
581
  key='custom_labels_input',
582
+ # Placeholder is now unnecessary as the value is pre-populated
 
 
583
  )
584
 
585
  col_results, col_clear = st.columns([1, 1])