niddijoris commited on
Commit
dafe229
Β·
verified Β·
1 Parent(s): 7d80464

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -21
app.py CHANGED
@@ -15,27 +15,27 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
15
  DB_PATH = os.path.join(BASE_DIR, "vector_db") # Ingest.py dagi bilan bir xil bo'lishi shart
16
  DATA_PATH = os.path.join(BASE_DIR, "data")
17
 
18
- st.sidebar.write("### Tizim holati:")
19
-
20
- # 1. Avval 'data' papkasida PDF-lar borligini tekshiramiz
21
- if not os.path.exists(DATA_PATH) or not os.listdir(DATA_PATH):
22
- st.sidebar.error("❌ 'data/' papkasida PDF fayllar topilmadi!")
23
- else:
24
- st.sidebar.success(f"πŸ“‚ {len(os.listdir(DATA_PATH))} ta PDF fayl topildi.")
25
-
26
- # 2. Bazani tekshirish va yaratish (CHROMA emas, VECTOR_DB)
27
- if not os.path.exists(DB_PATH):
28
- st.sidebar.warning("⚠️ Baza topilmadi. Ingest boshlanmoqda...")
29
- with st.spinner("Bilimlar bazasi yaratilmoqda..."):
30
- try:
31
- run_ingestion()
32
- st.success("βœ… Ingestion yakunlandi!")
33
- st.rerun() # Bazani ko'rishi uchun refresh
34
- except Exception as e:
35
- st.error(f"❌ Ingestion xatosi: {e}")
36
- else:
37
- st.sidebar.success(f"βœ… Baza tayyor: {DB_PATH}")
38
- st.sidebar.write("Fayllar:", os.listdir(DB_PATH))
39
 
40
  st.title("πŸ€– TechFlow Support Agent")
41
 
 
15
  DB_PATH = os.path.join(BASE_DIR, "vector_db") # Ingest.py dagi bilan bir xil bo'lishi shart
16
  DATA_PATH = os.path.join(BASE_DIR, "data")
17
 
18
+ # st.sidebar.write("### Tizim holati:")
19
+
20
+ # # 1. Avval 'data' papkasida PDF-lar borligini tekshiramiz
21
+ # if not os.path.exists(DATA_PATH) or not os.listdir(DATA_PATH):
22
+ # st.sidebar.error("❌ 'data/' papkasida PDF fayllar topilmadi!")
23
+ # else:
24
+ # st.sidebar.success(f"πŸ“‚ {len(os.listdir(DATA_PATH))} ta PDF fayl topildi.")
25
+
26
+ # # 2. Bazani tekshirish va yaratish (CHROMA emas, VECTOR_DB)
27
+ # if not os.path.exists(DB_PATH):
28
+ # st.sidebar.warning("⚠️ Baza topilmadi. Ingest boshlanmoqda...")
29
+ # with st.spinner("Bilimlar bazasi yaratilmoqda..."):
30
+ # try:
31
+ # run_ingestion()
32
+ # st.success("βœ… Ingestion yakunlandi!")
33
+ # st.rerun() # Bazani ko'rishi uchun refresh
34
+ # except Exception as e:
35
+ # st.error(f"❌ Ingestion xatosi: {e}")
36
+ # else:
37
+ # st.sidebar.success(f"βœ… Baza tayyor: {DB_PATH}")
38
+ # st.sidebar.write("Fayllar:", os.listdir(DB_PATH))
39
 
40
  st.title("πŸ€– TechFlow Support Agent")
41