ss900371tw commited on
Commit
c7fc236
·
verified ·
1 Parent(s): 80dd929

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +17 -0
src/streamlit_app.py CHANGED
@@ -33,7 +33,24 @@ except ImportError:
33
  st.set_page_config(page_title="Cybersecurity AI Assistant (Hugging Face RAG & Batch Analysis)", page_icon="🛡️", layout="wide")
34
  st.title("🛡️ Meta-Llama-3-8B-Instruct with FAISS RAG & Batch Analysis (Inference Client)")
35
  st.markdown("已啟用:**IndexFlatIP** + **L2 正規化** + **Hugging Face Inference Client (API)**。上傳 JSON 執行批量分析,上傳其他檔案作為 RAG 參考庫。")
 
 
 
 
 
36
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  # 設定模型 ID (替換為您指定的模型)
38
  MODEL_ID = "Zennar/Deecon-SecurityAnalyst-1.5B" ## meta-llama/Llama-4-Scout-17B-16E-Instruct
39
  WINDOW_SIZE = 8
 
33
  st.set_page_config(page_title="Cybersecurity AI Assistant (Hugging Face RAG & Batch Analysis)", page_icon="🛡️", layout="wide")
34
  st.title("🛡️ Meta-Llama-3-8B-Instruct with FAISS RAG & Batch Analysis (Inference Client)")
35
  st.markdown("已啟用:**IndexFlatIP** + **L2 正規化** + **Hugging Face Inference Client (API)**。上傳 JSON 執行批量分析,上傳其他檔案作為 RAG 參考庫。")
36
+ if 'execute_batch_analysis' not in st.session_state:
37
+ st.session_state.execute_batch_analysis = False
38
+
39
+ if 'batch_results' not in st.session_state:
40
+ st.session_state.batch_results = None # 確保初始化
41
 
42
+ if 'rag_current_file_key' not in st.session_state:
43
+ st.session_state.rag_current_file_key = None
44
+
45
+ if 'json_current_file_key' not in st.session_state:
46
+ st.session_state.json_current_file_key = None
47
+
48
+ # 確保所有用於存儲狀態的變量都已初始化,例如:
49
+ if 'vector_store' not in st.session_state:
50
+ st.session_state.vector_store = None
51
+
52
+ if 'json_data_for_batch' not in st.session_state:
53
+ st.session_state.json_data_for_batch = None
54
  # 設定模型 ID (替換為您指定的模型)
55
  MODEL_ID = "Zennar/Deecon-SecurityAnalyst-1.5B" ## meta-llama/Llama-4-Scout-17B-16E-Instruct
56
  WINDOW_SIZE = 8