Spaces:
Runtime error
Runtime error
Create gradio_ui.py
Browse files- gradio_ui.py +26 -0
gradio_ui.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# gradio_ui.py
|
3 |
+
import gradio as gr
|
4 |
+
import requests
|
5 |
+
|
6 |
+
API_BASE = "http://localhost:8000" # Adjust to your FastAPI base URL
|
7 |
+
|
8 |
+
def execute_task(team: str, task: str, prompt: str):
|
9 |
+
response = requests.post(f"{API_BASE}/execute", json={
|
10 |
+
"team": team, "task": task, "prompt": prompt
|
11 |
+
})
|
12 |
+
return response.json().get("output", "No output")
|
13 |
+
|
14 |
+
iface = gr.Interface(
|
15 |
+
fn=execute_task,
|
16 |
+
inputs=[
|
17 |
+
gr.Dropdown(["Red", "Blue"], label="Team"),
|
18 |
+
gr.Dropdown(["Recon", "Exploit", "Analyze Logs", "Generate Rule"], label="Task"),
|
19 |
+
gr.Textbox(label="Prompt / Parameters")
|
20 |
+
],
|
21 |
+
outputs="text",
|
22 |
+
title="AI-Driven CyberOps Interface"
|
23 |
+
)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
iface.launch()
|