Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,17 @@ def execute_task(req: TaskRequest):
|
|
| 24 |
raise HTTPException(status_code=400, detail="Invalid task")
|
| 25 |
return {"output": output}
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
|
| 29 |
import gradio as gr
|
|
@@ -32,10 +43,8 @@ import requests
|
|
| 32 |
API_BASE = "http://localhost:8000" # Adjust to your FastAPI base URL
|
| 33 |
|
| 34 |
def execute_task(team: str, task: str, prompt: str):
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
})
|
| 38 |
-
return response.json().get("output", "No output")
|
| 39 |
|
| 40 |
iface = gr.Interface(
|
| 41 |
fn=execute_task,
|
|
|
|
| 24 |
raise HTTPException(status_code=400, detail="Invalid task")
|
| 25 |
return {"output": output}
|
| 26 |
|
| 27 |
+
def execute_tasks(team: str, task: str, prompt: str):
|
| 28 |
+
# You can route tasks to different modules here
|
| 29 |
+
if team == "Red" and task == "Exploit":
|
| 30 |
+
# Stub: Replace with AI logic or subprocess
|
| 31 |
+
output = f"Running red team exploit with prompt: {prompt}"
|
| 32 |
+
elif team == "Blue" and task == "Analyze Logs":
|
| 33 |
+
# Example: Call AI model or subprocess
|
| 34 |
+
output = f"Parsing logs with AI assist: {prompt}"
|
| 35 |
+
else:
|
| 36 |
+
raise HTTPException(status_code=400, detail="Invalid task")
|
| 37 |
+
return {"output": output}
|
| 38 |
|
| 39 |
|
| 40 |
import gradio as gr
|
|
|
|
| 43 |
API_BASE = "http://localhost:8000" # Adjust to your FastAPI base URL
|
| 44 |
|
| 45 |
def execute_task(team: str, task: str, prompt: str):
|
| 46 |
+
|
| 47 |
+
return execute_tasks(team, task, prompt)
|
|
|
|
|
|
|
| 48 |
|
| 49 |
iface = gr.Interface(
|
| 50 |
fn=execute_task,
|