Update app.py
Browse files
app.py
CHANGED
|
@@ -1,119 +1,61 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
-
# Custom CSS to
|
| 5 |
custom_css = """
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 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:
|
| 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 |
-
|
| 32 |
-
|
| 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
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 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
|
| 78 |
-
gr.Markdown("<p style='color: #6b7280; font-size: 11px;'>200MB per file β’ PDF, TXT, DOCX</p>")
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
<
|
| 87 |
-
|
| 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 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
|
| 105 |
-
|
| 106 |
-
|
|
|
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
show_label=False,
|
| 112 |
-
|
| 113 |
-
scale=10,
|
| 114 |
-
elem_classes="chat-container"
|
| 115 |
-
)
|
| 116 |
-
submit_btn = gr.Button("β", scale=1, variant="primary")
|
| 117 |
|
| 118 |
-
|
| 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()
|
|
|