File size: 1,349 Bytes
f636163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0985b1d
f636163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a87aeaf
068543b
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
import gradio as gr
import os

from crewai import Crew, Process
# from agents import *
from agents import get_agents_and_tasks


def generate_video(topic, grow_api_key, stability_ai_api_key,openai_api_key):
    # os.environ['GROQ_API_KEY'] = grow_api_key
    os.environ['STABILITY_AI_API_KEY'] = stability_ai_api_key
    os.environ['OPENAI_API_KEY'] = openai_api_key
    agents, tasks = get_agents_and_tasks(grow_api_key)

    crew = Crew(
    # agents=[script_agent, image_descriptive_agent, img_speech_generating_agent, editor],
    # tasks=[content_generation_task, story_writing_task, img_text_task,speech_generation_task,make_video_task],
    agents = agents, 
    tasks = tasks,
    process = Process.sequential,
    # cache = True,
    memory=True,
    verbose=2
    )
    crew.kickoff(inputs={'topic': topic})
    return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'outputs/final_video/final_video.mp4')

app = gr.Interface(
    fn=generate_video,
    inputs=['text', 'text', 'text', 'text'],
    # outputs=gr.Video(value=os.path.join('outputs/final_video/video.mp4'),label="Generated Video", width=720/2, height=1280/2),
    outputs = gr.Video(format='mp4',label="Generated Video", width=720/2, height=1280/2),
    title="ShortsIn",
    description="Shorts generator"
)

app.launch()
#os.path.dirname(os.path.abspath(__file__))