sarthak20P commited on
Commit
ae30584
Β·
verified Β·
1 Parent(s): ee1b2a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -98
app.py CHANGED
@@ -1,119 +1,61 @@
1
  import gradio as gr
2
  import pandas as pd
3
 
4
- # Custom CSS to match the screenshot exactly
5
  custom_css = """
6
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
7
-
8
- .gradio-container {
9
- background-color: #06090f !important;
10
- font-family: 'Inter', sans-serif !important;
11
- color: white !important;
12
  }
13
-
14
- /* Sidebar Styling */
15
- .sidebar-content { padding: 20px; background: #0b0f19; height: 100%; border-right: 1px solid #1f2937; }
16
- .logo-area { text-align: center; margin-bottom: 30px; }
17
  .status-badge {
18
- background: rgba(16, 185, 129, 0.1);
19
- border: 1px solid #10b981;
20
- color: #10b981;
21
- padding: 8px 15px;
22
- border-radius: 20px;
23
- font-size: 12px;
24
- text-align: center;
25
- margin-bottom: 40px;
26
  }
27
-
28
- /* Metric Cards */
29
- .metrics-row { display: flex; gap: 15px; margin-bottom: 25px; }
30
  .card {
31
- flex: 1;
32
- background: #111827;
33
- padding: 20px;
34
- border-radius: 12px;
35
- text-align: center;
36
- border-top: 3px solid #3b82f6; /* Default blue */
37
- }
38
- .card.threat { border-top-color: #ef4444; }
39
- .card.safe { border-top-color: #10b981; }
40
- .card.rate { border-top-color: #8b5cf6; }
41
-
42
- .card-val { font-size: 28px; font-weight: 700; margin-bottom: 5px; }
43
- .card-label { font-size: 10px; color: #9ca3af; text-transform: uppercase; letter-spacing: 1px; }
44
-
45
- /* Accordion & Buttons */
46
- .establish-btn {
47
- background: linear-gradient(90deg, #3b82f6 0%, #00d4ff 100%) !important;
48
- border: none !important;
49
- color: white !important;
50
- font-weight: 600 !important;
51
- }
52
-
53
- /* Bottom Input Bar */
54
- .chat-container {
55
- background: #111827 !important;
56
- border: 1px solid #3b82f6 !important;
57
- border-radius: 10px !important;
58
  }
 
59
  """
60
 
61
- with gr.Blocks(css=custom_css, theme=gr.themes.Default()) as demo:
62
-
63
- # --- SIDEBAR PANEL ---
64
- with gr.Sidebar(elem_id="sidebar"):
65
- with gr.Column(elem_classes="sidebar-content"):
66
- with gr.Column(elem_classes="logo-area"):
67
- gr.HTML("""<div style='font-size: 40px;'>πŸ›‘οΈ</div>""")
68
- gr.Markdown("## **INTELLIGUARD**\nSECURITY PLATFORM")
69
-
70
  gr.HTML("<div class='status-badge'>● INTELLIGUARD PROTECTED</div>")
71
 
72
- gr.Markdown("### πŸ“‹ AUDIT LOG")
73
- gr.Markdown("<p style='color: #6b7280; font-size: 13px;'>No activity recorded yet.</p>")
74
-
75
  gr.Markdown("---")
76
  gr.Markdown("### πŸ“„ DOCUMENT UPLOAD")
77
- gr.File(label=None, file_count="multiple", elem_id="file-upload")
78
- gr.Markdown("<p style='color: #6b7280; font-size: 11px;'>200MB per file β€’ PDF, TXT, DOCX</p>")
79
 
80
- # --- MAIN CONTENT AREA ---
81
- with gr.Column():
82
- # Header Section
83
- gr.HTML("""
84
- <div style="text-align: center; margin-top: 20px;">
85
- <div style='font-size: 30px; margin-bottom: 10px;'>πŸ›‘οΈ</div>
86
- <h1 style="font-size: 32px; margin: 0;">TechCorp Employee Portal</h1>
87
- <p style="color: #6b7280;">Secured by <span style="color: #10b981;">IntelliGuard</span> β€’ 4-Layer Prompt Injection Detection</p>
88
- </div>
89
- """)
90
 
91
- # Metrics Grid
92
- with gr.Row(elem_classes="metrics-row"):
93
- gr.HTML("<div class='card'><div class='card-val' style='color:#3b82f6'>0</div><div class='card-label'>Total Queries</div></div>")
94
- gr.HTML("<div class='card threat'><div class='card-val' style='color:#ef4444'>0</div><div class='card-label'>Threats Blocked</div></div>")
95
- gr.HTML("<div class='card safe'><div class='card-val' style='color:#10b981'>0</div><div class='card-label'>Safe Queries</div></div>")
96
- gr.HTML("<div class='card rate'><div class='card-val' style='color:#8b5cf6'>100%</div><div class='card-label'>Safe Rate</div></div>")
97
-
98
- # Email Gateway Accordion
99
- with gr.Accordion("πŸ“§ Enterprise Email Gateway", open=True):
100
  with gr.Row():
101
- email_input = gr.Textbox(label="Target Email", value="security-ops@techcorp.com", interactive=True)
102
- pwd_input = gr.Textbox(label="App Password", type="password", placeholder="β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’β€’", interactive=True)
103
- connect_btn = gr.Button("πŸ”— Establish Secure Connection", elem_classes="establish-btn")
104
 
105
- # Spacing
106
- gr.Markdown("<div style='height: 100px;'></div>")
 
107
 
108
- # Footer Chat Bar
109
- with gr.Row():
110
- chat_input = gr.Textbox(
111
- show_label=False,
112
- placeholder="Ask about company policies, benefits, security guidelines...",
113
- scale=10,
114
- elem_classes="chat-container"
115
- )
116
- submit_btn = gr.Button("↑", scale=1, variant="primary")
117
 
118
- # Launch
119
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
1
  import gradio as gr
2
  import pandas as pd
3
 
4
+ # Custom CSS to force the "Sidebar" look in Gradio 4
5
  custom_css = """
6
+ .gradio-container { background-color: #06090f !important; color: white !important; }
7
+ .fake-sidebar {
8
+ background: #0b0f19 !important;
9
+ border-right: 1px solid #1f2937 !important;
10
+ padding: 20px !important;
11
+ min-width: 250px !important;
12
  }
 
 
 
 
13
  .status-badge {
14
+ background: rgba(16, 185, 129, 0.1); border: 1px solid #10b981; color: #10b981;
15
+ padding: 8px; border-radius: 20px; text-align: center; margin-bottom: 30px;
 
 
 
 
 
 
16
  }
 
 
 
17
  .card {
18
+ background: #111827; padding: 20px; border-radius: 12px; text-align: center;
19
+ border-top: 3px solid #3b82f6; margin-bottom: 10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
+ .establish-btn { background: linear-gradient(90deg, #3b82f6 0%, #00d4ff 100%) !important; color: white !important; }
22
  """
23
 
24
+ with gr.Blocks(css=custom_css) as demo:
25
+ with gr.Row():
26
+ # --- THE FAKE SIDEBAR ---
27
+ with gr.Column(scale=1, elem_classes="fake-sidebar"):
28
+ gr.HTML("<div style='font-size: 40px; text-align:center;'>πŸ›‘οΈ</div>")
29
+ gr.Markdown("## **INTELLIGUARD**\nSECURITY PLATFORM")
 
 
 
30
  gr.HTML("<div class='status-badge'>● INTELLIGUARD PROTECTED</div>")
31
 
32
+ gr.Markdown("### πŸ“‹ AUDIT LOG\n<p style='color: #6b7280;'>No activity recorded.</p>")
 
 
33
  gr.Markdown("---")
34
  gr.Markdown("### πŸ“„ DOCUMENT UPLOAD")
35
+ gr.File(label=None)
 
36
 
37
+ # --- THE MAIN CONTENT ---
38
+ with gr.Column(scale=4):
39
+ gr.HTML("""
40
+ <div style="text-align: center; margin-top: 20px;">
41
+ <h1 style="font-size: 32px;">TechCorp Employee Portal</h1>
42
+ <p style="color: #6b7280;">Secured by <span style="color: #10b981;">IntelliGuard</span></p>
43
+ </div>
44
+ """)
 
 
45
 
 
 
 
 
 
 
 
 
 
46
  with gr.Row():
47
+ gr.HTML("<div class='card' style='border-color:#3b82f6'><div style='font-size:24px'>0</div><div style='font-size:10px; color:#9ca3af'>Total Queries</div></div>")
48
+ gr.HTML("<div class='card' style='border-color:#ef4444'><div style='font-size:24px'>0</div><div style='font-size:10px; color:#9ca3af'>Threats Blocked</div></div>")
49
+ gr.HTML("<div class='card' style='border-color:#10b981'><div style='font-size:24px'>0</div><div style='font-size:10px; color:#9ca3af'>Safe Queries</div></div>")
50
 
51
+ with gr.Accordion("πŸ“§ Enterprise Email Gateway", open=True):
52
+ email = gr.Textbox(label="Target Email", value="security-ops@techcorp.com")
53
+ connect_btn = gr.Button("πŸ”— Establish Secure Connection", elem_classes="establish-btn")
54
 
55
+ gr.Markdown("<div style='height: 150px;'></div>")
56
+
57
+ with gr.Row():
58
+ chat = gr.Textbox(show_label=False, placeholder="Ask about company policies...", scale=10)
59
+ submit = gr.Button("↑", scale=1, variant="primary")
 
 
 
 
60
 
61
+ demo.launch()