rahimizadeh commited on
Commit
bb3ca4a
·
verified ·
1 Parent(s): 8ba201e

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +52 -0
  2. requirements.txt +7 -0
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Import Gradio for UI and your backend analysis module
2
+ import gradio as gr
3
+ from modules import analysis # assumes parser.py, vectorizer.py, analysis.py are in a "modules" folder
4
+
5
+ # Define the Gradio app using Blocks layout for full customization
6
+ with gr.Blocks(title="Log Intelligence Assistant") as demo:
7
+
8
+ # Header title
9
+ gr.Markdown("## 🔍 Interactive Network Log Assistant")
10
+
11
+ # -------- INPUTS TAB --------
12
+ with gr.Tab("Inputs 🔽"):
13
+ # File upload and raw text input
14
+ with gr.Row():
15
+ uploaded_files = gr.File(
16
+ file_types=[".pdf", ".log", ".txt"],
17
+ file_count="multiple", # allow multiple file uploads
18
+ label="📁 Upload Log Files"
19
+ )
20
+
21
+ text_input = gr.Textbox(
22
+ label="Paste Logs Here",
23
+ lines=15, # height of textbox
24
+ placeholder="2023-10-05 14:22:11 [Firewall] BLOCKED: 192.168.1.5..."
25
+ )
26
+
27
+ # Natural language query and quick predefined actions
28
+ with gr.Row():
29
+ query_input = gr.Textbox(
30
+ label="Ask About Logs",
31
+ placeholder="Find failed login attempts from 192.168.1.5"
32
+ )
33
+
34
+ quick_query = gr.Dropdown(
35
+ choices=["", "Detect anomalies", "Show blocked IPs", "Generate summary"],
36
+ label="Quick Actions"
37
+ )
38
+
39
+ # Optional model and filter configurations
40
+ with gr.Accordion("⚙️ Configuration Controls", open=False):
41
+ temperature = gr.Slider(
42
+ minimum=0.1, maximum=1.0, value=0.7,
43
+ label="Creativity (Temperature)"
44
+ )
45
+
46
+ start_time = gr.DateTime(label="Start Time")
47
+ end_time = gr.DateTime(label="End Time")
48
+
49
+ # -------- OUTPUTS TAB --------
50
+ with gr.Tab("Outputs 🔼"):
51
+ # Text output for log analysis result
52
+ analys
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ gradio
2
+ langchain
3
+ transformers
4
+ faiss-cpu
5
+ pymupdf
6
+ pandas
7
+ tiktoken