rahimizadeh commited on
Commit
5da461e
·
verified ·
1 Parent(s): 87379d1

Update modules/analysis.py

Browse files
Files changed (1) hide show
  1. modules/analysis.py +0 -36
modules/analysis.py CHANGED
@@ -6,39 +6,3 @@ from modules import parser, vectorizer
6
  def run_analysis(uploaded_files, text_input, query, quick_action, temperature, start_time, end_time):
7
  print("🔥 run_analysis called") # Will appear in Application Logs
8
  return "Function was triggered!", None, None, [("INFO", "Test log processed")]
9
-
10
-
11
- """def run_analysis(uploaded_files, text_input, query, quick_action, temperature, start_time, end_time):
12
- print("🔥 run_analysis called")
13
- logs_text = ""
14
-
15
- if uploaded_files:
16
- logs_text += parser.parse_uploaded_files(uploaded_files)
17
-
18
- if text_input:
19
- logs_text += "\n" + text_input
20
-
21
- if not logs_text.strip():
22
- return "❌ No logs provided.", None, None, None
23
-
24
- query_text = query if query else quick_action
25
- if not query_text:
26
- return "❌ No query provided.", None, None, None
27
-
28
- docs = vectorizer.prepare_documents(logs_text)
29
- vectordb = vectorizer.create_vectorstore(docs)
30
-
31
- pipe = pipeline("text-generation", model="gpt2", max_length=512, temperature=temperature)
32
- llm = HuggingFacePipeline(pipeline=pipe)
33
-
34
- qa = RetrievalQA.from_chain_type(llm=llm, retriever=vectordb.as_retriever())
35
- result = qa.run(query_text)
36
-
37
- # Example mock output
38
- bar_data = {"Hour": ["14:00", "15:00"], "Count": [8, 4]}
39
- pie_data = {"Event Type": ["Blocked", "Scan"], "Count": [8, 4]}
40
- alerts = [("CRITICAL", "8 blocked SSH attempts from 192.168.1.5"),
41
- ("WARNING", "4 port scanning alerts from 10.0.0.8")]
42
-
43
- return result, bar_data, pie_data, alerts""
44
-
 
6
  def run_analysis(uploaded_files, text_input, query, quick_action, temperature, start_time, end_time):
7
  print("🔥 run_analysis called") # Will appear in Application Logs
8
  return "Function was triggered!", None, None, [("INFO", "Test log processed")]