|
|
import gradio as gr |
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
df = pd.read_csv("human_like_security_reasoning.csv") |
|
|
|
|
|
def get_scenario(scenario_id): |
|
|
row = df[df["scenario_id"] == scenario_id].iloc[0] |
|
|
return ( |
|
|
row["situation"], |
|
|
row["context"], |
|
|
row["human_thought_process"], |
|
|
row["possible_mistake"], |
|
|
row["correct_decision"], |
|
|
row["risk_level"], |
|
|
row["explanation"] |
|
|
) |
|
|
|
|
|
with gr.Blocks(title="Human-Like Security Reasoning Explorer") as demo: |
|
|
gr.Markdown(""" |
|
|
# 🔐 Human-Like Security Reasoning Explorer |
|
|
|
|
|
Explore cybersecurity, system, and network scenarios |
|
|
with **human-style thinking and decision making**. |
|
|
""") |
|
|
|
|
|
scenario_selector = gr.Dropdown( |
|
|
choices=df["scenario_id"].tolist(), |
|
|
label="Select Scenario ID" |
|
|
) |
|
|
|
|
|
situation = gr.Textbox(label="Situation") |
|
|
context = gr.Textbox(label="Context") |
|
|
thought = gr.Textbox(label="Human Thought Process") |
|
|
mistake = gr.Textbox(label="Possible Mistake") |
|
|
decision = gr.Textbox(label="Correct Decision") |
|
|
risk = gr.Textbox(label="Risk Level") |
|
|
explanation = gr.Textbox(label="Explanation") |
|
|
|
|
|
scenario_selector.change( |
|
|
get_scenario, |
|
|
inputs=scenario_selector, |
|
|
outputs=[ |
|
|
situation, |
|
|
context, |
|
|
thought, |
|
|
mistake, |
|
|
decision, |
|
|
risk, |
|
|
explanation |
|
|
] |
|
|
) |
|
|
|
|
|
demo.launch() |