Manasa1 commited on
Commit
0f74bf6
·
verified ·
1 Parent(s): 77e35bb

Rename app.py to crew_setup.py

Browse files
Files changed (1) hide show
  1. app.py → crew_setup.py +99 -129
app.py → crew_setup.py RENAMED
@@ -1,129 +1,99 @@
1
- from crewai import Agent, Task, Crew, Process
2
- from crewai_tools import GPTNeoTool, CoquiTTSTool, AudioCraftTool, StableDiffusionTool, MoviePyTool, WebSocketTool, StreamlitTool
3
-
4
- # Define the agents using open-source models
5
-
6
- # 1. Comedy Script Generation Agent using GPT-Neo (open-source model)
7
- comedy_writer = Agent(
8
- role="Comedy Show Scriptwriter",
9
- tools=[GPTNeoTool()],
10
- prompt=(
11
- "You are a comedy scriptwriter. Write a hilarious comedy show script. "
12
- "Each script should be around 5 minutes long, full of humor, and interactive."
13
- "\n- Theme: {theme}"
14
- "\n- Comedy Type: {comedy_type} (e.g., stand-up, skits, improv)"
15
- "\n- Characters: {characters}"
16
- "\n- Story: Write a funny and engaging plot that the audience will enjoy."
17
- "\n- Final Output: A 5-minute comedy script with multiple scenes."
18
- )
19
- )
20
-
21
- # 2. Children's Music Composer Agent using Coqui TTS and AudioCraft (open-source models)
22
- music_composer = Agent(
23
- role="Children's Song Composer",
24
- tools=[CoquiTTSTool(), AudioCraftTool()],
25
- prompt=(
26
- "You are a children's music composer. Create a catchy and fun song for kids based on the given theme."
27
- "\n- Theme: {music_theme} (e.g., Baby Shark, Nursery Rhymes)"
28
- "\n- Lyrics: Write simple, repetitive, and easy-to-remember lyrics that kids will love."
29
- "\n- Tune: Create a playful and upbeat melody using instruments like piano, xylophone, and drums."
30
- "\n- Voices: Generate character voices using Coqui TTS in a friendly, fun tone."
31
- "\n- Final Output: A custom children's song with lyrics, vocals, and music."
32
- )
33
- )
34
-
35
- # 3. Video Generation Agent using Stable Diffusion for image generation and DeepFloyd IF for video interpolation
36
- video_producer = Agent(
37
- role="Comedy and Music Video Producer",
38
- tools=[StableDiffusionTool(), DeepFloydIFTool()],
39
- prompt=(
40
- "You are a video producer. Create animated videos based on the provided comedy script or children's song."
41
- "\n- Script/Song: {script_or_song}"
42
- "\n- Generate key frames using Stable Diffusion for each scene in the script or song."
43
- "\n- Use DeepFloyd IF to interpolate between the frames to create smooth video transitions."
44
- "\n- Final Output: A short animated video with visuals synchronized to the script or song."
45
- )
46
- )
47
-
48
- # 4. Live Streaming and User Interaction Agent using WebSocket and Streamlit
49
- live_manager = Agent(
50
- role="Live Show Interaction Manager",
51
- tools=[WebSocketTool()],
52
- prompt=(
53
- "You are managing a live comedy show where users can interact in real-time to control the flow of the show."
54
- "\n- Allow users to vote on the next skit, select character actions, and influence the direction of the story."
55
- "\n- Display the live show on the web using WebSocket connections, allowing users to engage and participate."
56
- "\n- Implement chat-based interactions where users' votes or inputs directly influence the scenes."
57
- "\n- Final Output: A live streaming experience with real-time audience interaction."
58
- )
59
- )
60
-
61
- # 5. Web App Management Agent using Streamlit for frontend and backend management
62
- web_app_developer = Agent(
63
- role="Web App Manager",
64
- tools=[StreamlitTool()],
65
- prompt=(
66
- "You are responsible for managing the backend and frontend of the web app where users can generate comedy shows "
67
- "and children's music videos."
68
- "\n- Build a user-friendly interface where users can enter themes, select comedy styles, and generate music."
69
- "\n- Integrate real-time interactions for live comedy shows."
70
- "\n- Ensure the app provides easy access to content generation and live-streaming options."
71
- "\n- Final Output: A fully functional web app where users can create, view, and interact with generated content."
72
- )
73
- )
74
-
75
- # Define the tasks for each agent
76
-
77
- # Comedy script generation task
78
- generate_comedy_task = Task(
79
- description="Generate a 5-minute comedy script based on user input.",
80
- expected_output="A comedy script in text format, ready for video production.",
81
- agent=comedy_writer
82
- )
83
-
84
- # Children's music generation task
85
- generate_music_task = Task(
86
- description="Create a children's song based on the provided theme.",
87
- expected_output="A song with lyrics, vocals, and background music.",
88
- agent=music_composer
89
- )
90
-
91
- # Video production task
92
- generate_video_task = Task(
93
- description="Generate a video from the comedy script or children's song using open-source image and video generation tools.",
94
- expected_output="A short animated video synchronized to the script or song.",
95
- agent=video_producer
96
- )
97
-
98
- # Live interaction management task
99
- manage_live_stream_task = Task(
100
- description="Manage real-time user interaction for live comedy shows.",
101
- expected_output="A live stream with real-time audience interaction.",
102
- agent=live_manager
103
- )
104
-
105
- # Web app management task
106
- manage_web_app_task = Task(
107
- description="Develop and manage the web app for content generation and interaction.",
108
- expected_output="A fully functional web app that allows users to create and interact with content.",
109
- agent=web_app_developer
110
- )
111
-
112
- # Create the CrewAI process
113
- crew = Crew(
114
- agents=[comedy_writer, music_composer, video_producer, live_manager, web_app_developer],
115
- tasks=[generate_comedy_task, generate_music_task, generate_video_task, manage_live_stream_task, manage_web_app_task],
116
- process=Process.sequential
117
- )
118
-
119
- # Start the CrewAI process by giving the input themes for comedy and children's music
120
- inputs = {
121
- 'theme': 'Interdimensional Comedy', # For comedy
122
- 'comedy_type': 'Slapstick', # Type of comedy
123
- 'characters': 'Alien, Robot, Human', # Characters for the comedy show
124
- 'music_theme': 'Baby Shark Adventure Remix' # Theme for children's music
125
- }
126
-
127
- # Kick off the crew and print the result
128
- result = crew.kickoff(inputs)
129
- print(result)
 
1
+ from crewai import Agent, Task, Crew, Process
2
+ from crewai_tools import GPTNeoTool, CoquiTTSTool, AudioCraftTool, StableDiffusionTool, MoviePyTool, WebSocketTool, StreamlitTool
3
+
4
+ # Define the agents using open-source models
5
+
6
+ # 1. Comedy Script Generation Agent using GPT-Neo (open-source model)
7
+ comedy_writer = Agent(
8
+ role="Comedy Show Scriptwriter",
9
+ tools=[GPTNeoTool()],
10
+ prompt=(
11
+ "You are a comedy scriptwriter. Write a hilarious comedy show script. "
12
+ "Each script should be around 5 minutes long, full of humor, and interactive."
13
+ "\n- Theme: {theme}"
14
+ "\n- Comedy Type: {comedy_type} (e.g., stand-up, skits, improv)"
15
+ "\n- Characters: {characters}"
16
+ "\n- Story: Write a funny and engaging plot that the audience will enjoy."
17
+ "\n- Final Output: A 5-minute comedy script with multiple scenes."
18
+ )
19
+ )
20
+
21
+ # 2. Children's Music Composer Agent using Coqui TTS and AudioCraft (open-source models)
22
+ music_composer = Agent(
23
+ role="Children's Song Composer",
24
+ tools=[CoquiTTSTool(), AudioCraftTool()],
25
+ prompt=(
26
+ "You are a children's music composer. Create a catchy and fun song for kids based on the given theme."
27
+ "\n- Theme: {music_theme} (e.g., Baby Shark, Nursery Rhymes)"
28
+ "\n- Lyrics: Write simple, repetitive, and easy-to-remember lyrics that kids will love."
29
+ "\n- Tune: Create a playful and upbeat melody using instruments like piano, xylophone, and drums."
30
+ "\n- Voices: Generate character voices using Coqui TTS in a friendly, fun tone."
31
+ "\n- Final Output: A custom children's song with lyrics, vocals, and music."
32
+ )
33
+ )
34
+
35
+ # 3. Video Generation Agent using Stable Diffusion for image generation and DeepFloyd IF for video interpolation
36
+ video_producer = Agent(
37
+ role="Comedy and Music Video Producer",
38
+ tools=[StableDiffusionTool(), DeepFloydIFTool()],
39
+ prompt=(
40
+ "You are a video producer. Create animated videos based on the provided comedy script or children's song."
41
+ "\n- Script/Song: {script_or_song}"
42
+ "\n- Generate key frames using Stable Diffusion for each scene in the script or song."
43
+ "\n- Use DeepFloyd IF to interpolate between the frames to create smooth video transitions."
44
+ "\n- Final Output: A short animated video with visuals synchronized to the script or song."
45
+ )
46
+ )
47
+
48
+ # 4. Live Streaming and User Interaction Agent using WebSocket and Streamlit
49
+ live_manager = Agent(
50
+ role="Live Show Interaction Manager",
51
+ tools=[WebSocketTool()],
52
+ prompt=(
53
+ "You are managing a live comedy show where users can interact in real-time to control the flow of the show."
54
+ "\n- Allow users to vote on the next skit, select character actions, and influence the direction of the story."
55
+ "\n- Display the live show on the web using WebSocket connections, allowing users to engage and participate."
56
+ "\n- Implement chat-based interactions where users' votes or inputs directly influence the scenes."
57
+ "\n- Final Output: A live streaming experience with real-time audience interaction."
58
+ )
59
+ )
60
+
61
+
62
+
63
+ # Comedy script generation task
64
+ generate_comedy_task = Task(
65
+ description="Generate a 5-minute comedy script based on user input.",
66
+ expected_output="A comedy script in text format, ready for video production.",
67
+ agent=comedy_writer
68
+ )
69
+
70
+ # Children's music generation task
71
+ generate_music_task = Task(
72
+ description="Create a children's song based on the provided theme.",
73
+ expected_output="A song with lyrics, vocals, and background music.",
74
+ agent=music_composer
75
+ )
76
+
77
+ # Video production task
78
+ generate_video_task = Task(
79
+ description="Generate a video from the comedy script or children's song using open-source image and video generation tools.",
80
+ expected_output="A short animated video synchronized to the script or song.",
81
+ agent=video_producer
82
+ )
83
+
84
+ # Live interaction management task
85
+ manage_live_stream_task = Task(
86
+ description="Manage real-time user interaction for live comedy shows.",
87
+ expected_output="A live stream with real-time audience interaction.",
88
+ agent=live_manager
89
+ )
90
+
91
+
92
+ # Create the CrewAI process
93
+ crew = Crew(
94
+ agents=[comedy_writer, music_composer, video_producer, live_manager, web_app_developer],
95
+ tasks=[generate_comedy_task, generate_music_task, generate_video_task, manage_live_stream_task, manage_web_app_task],
96
+ process=Process.sequential
97
+ )
98
+
99
+