Shubham170793 commited on
Commit
e9c70f2
·
verified ·
1 Parent(s): 0cacffd

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +13 -4
src/streamlit_app.py CHANGED
@@ -1,9 +1,10 @@
1
  import os
2
  import streamlit as st
3
- from ingestion import extract_text_from_pdf, chunk_text
4
- from embeddings import generate_embeddings
5
- from vectorstore import build_faiss_index
6
- from qa import retrieve_chunks, generate_answer
 
7
 
8
  # ---------------------------
9
  # Cache Fix for Hugging Face
@@ -15,6 +16,14 @@ os.environ["TRANSFORMERS_CACHE"] = CACHE_DIR
15
  os.environ["HF_DATASETS_CACHE"] = CACHE_DIR
16
  os.environ["HF_MODULES_CACHE"] = CACHE_DIR
17
 
 
 
 
 
 
 
 
 
18
  # ---------------------------
19
  # Paths
20
  # ---------------------------
 
1
  import os
2
  import streamlit as st
3
+
4
+ # --- Streamlit safe options (prevents upload 403 / CORS issues) ---
5
+ st.set_option("client.showErrorDetails", True)
6
+ st.set_option("server.enableXsrfProtection", False)
7
+ st.set_option("server.enableCORS", True)
8
 
9
  # ---------------------------
10
  # Cache Fix for Hugging Face
 
16
  os.environ["HF_DATASETS_CACHE"] = CACHE_DIR
17
  os.environ["HF_MODULES_CACHE"] = CACHE_DIR
18
 
19
+ # ---------------------------
20
+ # Imports AFTER environment setup
21
+ # ---------------------------
22
+ from ingestion import extract_text_from_pdf, chunk_text
23
+ from embeddings import generate_embeddings
24
+ from vectorstore import build_faiss_index
25
+ from qa import retrieve_chunks, generate_answer
26
+
27
  # ---------------------------
28
  # Paths
29
  # ---------------------------