Zwounds commited on
Commit
eea9674
Β·
verified Β·
1 Parent(s): cc432be

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -318,9 +318,9 @@ Answer:"""
318
  return prompt
319
 
320
  # --- Streamlit App UI ---
321
- st.title("πŸ“š Ask the Library Guides (Dataset Embed + HF Gen)")
322
 
323
- # User input (only proceed if collection is ready)
324
  if collection:
325
  query = st.text_area("Enter your question:", height=100)
326
  else:
@@ -529,17 +529,18 @@ if collection and st.button("Ask"):
529
  st.info("No specific context was retrieved from the guides to answer this question.")
530
 
531
  # Add instructions or footer
532
- st.sidebar.header("How to Use")
533
  st.sidebar.info(
534
- "1. Ensure your `HUGGING_FACE_HUB_TOKEN` is correctly set as a Space secret (`HF_TOKEN`) or in the `.env` file.\n"
535
- f"2. The app will load pre-computed embeddings from the HF Dataset (`{HF_DATASET_ID}`).\n"
536
- " (Ensure the dataset was created correctly using `export_chroma_to_parquet.py` and `upload_dataset_to_hf.py`)\n"
537
- "3. Enter your question in the text area.\n"
538
- "4. Click 'Ask'."
539
  )
540
- st.sidebar.header("Configuration")
541
- st.sidebar.markdown(f"**Embedding:** Pre-computed (`{LOCAL_EMBEDDING_MODEL}` loaded from HF Dataset)")
542
- st.sidebar.markdown(f"**LLM (HF API):** `{HF_GENERATION_MODEL}`")
543
- st.sidebar.markdown(f"**ChromaDB Collection:** `{COLLECTION_NAME}` (In-Memory)")
 
544
  st.sidebar.markdown(f"**Retrieval Mode:** Vector Search Only")
545
  st.sidebar.markdown(f"**Final Unique Chunks:** `{TOP_K}` (from initial `{INITIAL_N_RESULTS}` vector search)")
 
318
  return prompt
319
 
320
  # --- Streamlit App UI ---
321
+ st.title("πŸ“š Experimental LibGuides RAG Demo") # Revised title
322
 
323
+ # User input (only proceed if collection loaded)
324
  if collection:
325
  query = st.text_area("Enter your question:", height=100)
326
  else:
 
529
  st.info("No specific context was retrieved from the guides to answer this question.")
530
 
531
  # Add instructions or footer
532
+ st.sidebar.header("About This Demo")
533
  st.sidebar.info(
534
+ "This is an experimental RAG demo using CUNY GC LibGuides content.\n\n"
535
+ "1. It loads pre-computed embeddings from a Hugging Face Dataset.\n"
536
+ "2. It embeds your query locally.\n"
537
+ "3. It uses the Hugging Face Inference API for LLM tasks (routing, generation).\n"
538
+ "4. Requires a `HUGGING_FACE_HUB_TOKEN` set as a Space secret (`HF_TOKEN`) or in `.env`."
539
  )
540
+ st.sidebar.header("Configuration Used")
541
+ st.sidebar.markdown(f"**Embedding Source:** HF Dataset (`{HF_DATASET_ID}`)")
542
+ st.sidebar.markdown(f"**Query Embedding Model:** Local (`{LOCAL_EMBEDDING_MODEL}`)")
543
+ st.sidebar.markdown(f"**Generation LLM (HF API):** `{HF_GENERATION_MODEL}`")
544
+ st.sidebar.markdown(f"**Vector Store:** ChromaDB (In-Memory)")
545
  st.sidebar.markdown(f"**Retrieval Mode:** Vector Search Only")
546
  st.sidebar.markdown(f"**Final Unique Chunks:** `{TOP_K}` (from initial `{INITIAL_N_RESULTS}` vector search)")