commit
7c740ad19c
After Width: | Height: | Size: 52 KiB |
@ -0,0 +1,80 @@
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from swarms.models import GPT4VisionAPI
|
||||
from swarms.structs import Agent
|
||||
import swarms.prompts.security_team as stsp
|
||||
|
||||
# Load environment variables and initialize the Vision API
|
||||
load_dotenv()
|
||||
api_key = os.getenv("OPENAI_API_KEY")
|
||||
|
||||
llm = GPT4VisionAPI(openai_api_key=api_key)
|
||||
|
||||
# Image for analysis
|
||||
img = "bank_robbery.jpg"
|
||||
|
||||
# Initialize agents with respective prompts for security tasks
|
||||
crowd_analysis_agent = Agent(
|
||||
llm=llm,
|
||||
sop=stsp.CROWD_ANALYSIS_AGENT_PROMPT,
|
||||
max_loops=1,
|
||||
multi_modal=True,
|
||||
)
|
||||
|
||||
# Facial Recognition Agent is currently not operational
|
||||
# facial_recognition_agent = Agent(
|
||||
# llm=llm,
|
||||
# sop=stsp.FACIAL_RECOGNITION_AGENT_PROMPT,
|
||||
# max_loops=1,
|
||||
# multi_modal=True,
|
||||
# )
|
||||
|
||||
weapon_detection_agent = Agent(
|
||||
llm=llm,
|
||||
sop=stsp.WEAPON_DETECTION_AGENT_PROMPT,
|
||||
max_loops=1,
|
||||
multi_modal=True,
|
||||
)
|
||||
|
||||
surveillance_monitoring_agent = Agent(
|
||||
llm=llm,
|
||||
sop=stsp.SURVEILLANCE_MONITORING_AGENT_PROMPT,
|
||||
max_loops=1,
|
||||
multi_modal=True,
|
||||
)
|
||||
|
||||
emergency_response_coordinator = Agent(
|
||||
llm=llm,
|
||||
sop=stsp.EMERGENCY_RESPONSE_COORDINATOR_PROMPT,
|
||||
max_loops=1,
|
||||
multi_modal=True,
|
||||
)
|
||||
|
||||
# Run agents with respective tasks on the same image
|
||||
crowd_analysis = crowd_analysis_agent.run(
|
||||
"Analyze the crowd dynamics in the scene", img
|
||||
)
|
||||
|
||||
# Facial Recognition Agent is currently not operational
|
||||
# facial_recognition_analysis = facial_recognition_agent.run(
|
||||
# "Identify any known individuals in the scene", img
|
||||
# )
|
||||
|
||||
weapon_detection_analysis = weapon_detection_agent.run(
|
||||
"Inspect the scene for any potential threats", img
|
||||
)
|
||||
|
||||
surveillance_monitoring_analysis = surveillance_monitoring_agent.run(
|
||||
"Monitor the overall scene for unusual activities", img
|
||||
)
|
||||
|
||||
emergency_response_analysis = emergency_response_coordinator.run(
|
||||
"Develop a response plan based on the scene analysis", img
|
||||
)
|
||||
|
||||
# Process and output results for each task
|
||||
# Example output (uncomment to use):
|
||||
# print(f"Crowd Analysis: {crowd_analysis}")
|
||||
# print(f"Weapon Detection Analysis: {weapon_detection_analysis}")
|
||||
# print(f"Surveillance Monitoring Analysis: {surveillance_monitoring_analysis}")
|
||||
# print(f"Emergency Response Analysis: {emergency_response_analysis}")
|
@ -0,0 +1,28 @@
|
||||
# Filename: security_team_swarm_prompts.py
|
||||
|
||||
# Surveillance Monitoring Agent Prompt
|
||||
SURVEILLANCE_MONITORING_AGENT_PROMPT = """
|
||||
"Constantly monitor live video feeds for any unusual activities or potential security threats, especially during public events like parades or in high-security areas. Look for patterns indicative of suspicious behavior such as loitering, unattended items, or unauthorized entries. Pay particular attention to areas that are typically crowded or have high-value assets. Flag any anomalies and notify relevant agents immediately for further assessment and action."
|
||||
"""
|
||||
|
||||
# Crowd Analysis Agent Prompt
|
||||
CROWD_ANALYSIS_AGENT_PROMPT = """
|
||||
"Analyze crowd density, movement, and behavior from video surveillance to detect signs of distress or panic within the bystanders/crowd, such as at concerts, sports events, or train stations. Focus on understanding and preempting incidents by recognizing patterns of crowd formation, movement speed variations, and signs of agitation or distress."
|
||||
"""
|
||||
|
||||
# Facial Recognition Agent Prompt
|
||||
FACIAL_RECOGNITION_AGENT_PROMPT = """
|
||||
"Scan all individuals in the video feed using facial recognition technology. Cross-reference detected faces with a database of known offenders or persons of interest, ensuring a high accuracy threshold. Focus on both high-traffic public spaces and controlled environments. Your aim is to identify potential threats quickly while minimizing false positives. Alert the team immediately if any matches are found for immediate action."
|
||||
"""
|
||||
|
||||
# Weapon Detection Agent Prompt
|
||||
WEAPON_DETECTION_AGENT_PROMPT = """
|
||||
"Inspect video frames meticulously for visible weapons or items that may be used as weapons, including firearms, knives, or any unusual objects that could pose a threat. Pay special attention to how individuals handle such objects and the context of their environment. Your goal is to ensure early detection and distinguish between real threats and benign objects. Raise an alert with precise details if any weapon is spotted."
|
||||
"""
|
||||
|
||||
# Emergency Response Coordinator Prompt
|
||||
EMERGENCY_RESPONSE_COORDINATOR_PROMPT = """
|
||||
"Assess and coordinate the team's response to security incidents or emergencies as they arise. Evaluate the nature and severity of each identified threat, factoring in the input from other AI agents. Your role is to develop a comprehensive plan of action to mitigate the threat, communicate effectively with all involved agents, and provide a full briefing for emergency response teams. Ensure swift and efficient decision-making processes in various threat scenarios."
|
||||
"""
|
||||
|
||||
# You can import these prompts in your main application where the agents are defined and utilized.
|
Loading…
Reference in new issue