-
-
Notifications
You must be signed in to change notification settings - Fork 781
Expand file tree
/
Copy pathmultimodal.py
More file actions
58 lines (51 loc) · 1.8 KB
/
multimodal.py
File metadata and controls
58 lines (51 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from praisonaiagents import Agent, Task, AgentTeam
# Create Vision Analysis Agent
vision_agent = Agent(
name="VisionAnalyst",
role="Computer Vision Specialist",
goal="Analyze images and videos to extract meaningful information",
backstory="""You are an expert in computer vision and image analysis.
You excel at describing images, detecting objects, and understanding visual content.""",
llm="gpt-4o-mini",
reflection=False
)
# 1. Task with Image URL
task1 = Task(
name="analyze_landmark",
description="Describe this famous landmark and its architectural features.",
expected_output="Detailed description of the landmark's architecture and significance",
agent=vision_agent,
images=["https://upload.wikimedia.org/wikipedia/commons/b/bf/Krakow_-_Kosciol_Mariacki.jpg"]
)
# 2. Task with Local Image File
task2 = Task(
name="analyze_local_image",
description="What objects can you see in this image? Describe their arrangement.",
expected_output="Detailed description of objects and their spatial relationships",
agent=vision_agent,
images=["image.jpg"]
)
# 3. Task with Video File
task3 = Task(
name="analyze_video",
description="""Watch this video and provide:
1. A summary of the main events
2. Key objects and people visible
3. Any text or important information shown
4. The overall context and setting""",
expected_output="Comprehensive analysis of the video content",
agent=vision_agent,
images=["video.mp4"]
)
# Create Agents instance
agents = AgentTeam(
agents=[vision_agent],
tasks=[task1, task2, task3],
process="sequential"
)
# Run all tasks
result = agents.start()
# Print results
for task_id, task_result in result["task_results"].items():
print(f"\nTask {task_id} Result:")
print(task_result.raw)