Spaces:
Build error
Build error
File size: 3,136 Bytes
0f74bf6 |
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
from crewai import Agent, Task, Crew, Process
from crewai_tools import GPTNeoTool, CoquiTTSTool, AudioCraftTool, StableDiffusionTool, MoviePyTool, WebSocketTool, StreamlitTool
# Define the agents using open-source models
# 1. Comedy Script Generation Agent using GPT-Neo (open-source model)
comedy_writer = Agent(
role="Comedy Show Scriptwriter",
tools=[GPTNeoTool()],
prompt=(
"You are a comedy scriptwriter. Write a hilarious comedy show script. "
"Each script should be around 5 minutes long, full of humor, and interactive."
"\n- Theme: {theme}"
"\n- Comedy Type: {comedy_type} (e.g., stand-up, skits, improv)"
"\n- Characters: {characters}"
"\n- Story: Write a funny and engaging plot that the audience will enjoy."
"\n- Final Output: A 5-minute comedy script with multiple scenes."
)
)
# 2. Children's Music Composer Agent using Coqui TTS and AudioCraft (open-source models)
music_composer = Agent(
role="Children's Song Composer",
tools=[CoquiTTSTool(), AudioCraftTool()],
prompt=(
"You are a children's music composer. Create a catchy and fun song for kids based on the given theme."
"\n- Theme: {music_theme} (e.g., Baby Shark, Nursery Rhymes)"
"\n- Lyrics: Write simple, repetitive, and easy-to-remember lyrics that kids will love."
"\n- Tune: Create a playful and upbeat melody using instruments like piano, xylophone, and drums."
"\n- Voices: Generate character voices using Coqui TTS in a friendly, fun tone."
"\n- Final Output: A custom children's song with lyrics, vocals, and music."
)
)
# 3. Video Generation Agent using Stable Diffusion for image generation and DeepFloyd IF for video interpolation
video_producer = Agent(
role="Comedy and Music Video Producer",
tools=[StableDiffusionTool(), DeepFloydIFTool()],
prompt=(
"You are a video producer. Create animated videos based on the provided comedy script or children's song."
"\n- Script/Song: {script_or_song}"
"\n- Generate key frames using Stable Diffusion for each scene in the script or song."
"\n- Use DeepFloyd IF to interpolate between the frames to create smooth video transitions."
"\n- Final Output: A short animated video with visuals synchronized to the script or song."
)
)
# Comedy script generation task
generate_comedy_task = Task(
description="Generate a 5-minute comedy script based on user input.",
expected_output="A comedy script in text format, ready for video production.",
agent=comedy_writer
)
# Children's music generation task
generate_music_task = Task(
description="Create a children's song based on the provided theme.",
expected_output="A song with lyrics, vocals, and background music.",
agent=music_composer
)
# Video production task
generate_video_task = Task(
description="Generate a video from the comedy script or children's song using open-source image and video generation tools.",
expected_output="A short animated video synchronized to the script or song.",
agent=video_producer
)
|