Spaces:
Sleeping
Sleeping
Prudvireddy
commited on
Commit
•
f636163
1
Parent(s):
da6bfe6
Update app.py
Browse files
app.py
CHANGED
@@ -1,33 +1,38 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import os
|
3 |
-
|
4 |
-
from crewai import Crew, Process
|
5 |
-
from agents import *
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
os.environ['
|
11 |
-
|
12 |
-
|
13 |
-
agents
|
14 |
-
|
15 |
-
|
16 |
-
#
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
inputs=
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
33 |
#os.path.dirname(os.path.abspath(__file__))
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
|
4 |
+
from crewai import Crew, Process
|
5 |
+
# from agents import *
|
6 |
+
from agents import get_agents_and_tasks
|
7 |
+
|
8 |
+
|
9 |
+
def generate_video(topic, grow_api_key, stability_ai_api_key,openai_api_key):
|
10 |
+
# os.environ['GROQ_API_KEY'] = grow_api_key
|
11 |
+
os.environ['STABILITY_AI_API_KEY'] = stability_ai_api_key
|
12 |
+
os.environ['OPENAI_API_KEY'] = openai_api_key
|
13 |
+
agents, tasks = get_agents_and_tasks(grow_api_key)
|
14 |
+
|
15 |
+
crew = Crew(
|
16 |
+
# agents=[script_agent, image_descriptive_agent, img_speech_generating_agent, editor],
|
17 |
+
# tasks=[content_generation_task, story_writing_task, img_text_task, img_generation_task,speech_generation_task,make_video_task],
|
18 |
+
agents = agents,
|
19 |
+
tasks = tasks,
|
20 |
+
process = Process.sequential,
|
21 |
+
# cache = True,
|
22 |
+
memory=True,
|
23 |
+
verbose=2
|
24 |
+
)
|
25 |
+
crew.kickoff(inputs={'topic': topic})
|
26 |
+
return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'outputs/final_video/final_video.mp4')
|
27 |
+
|
28 |
+
app = gr.Interface(
|
29 |
+
fn=generate_video,
|
30 |
+
inputs=['text', 'text', 'text', 'text'],
|
31 |
+
# outputs=gr.Video(value=os.path.join('outputs/final_video/video.mp4'),label="Generated Video", width=720/2, height=1280/2),
|
32 |
+
outputs = gr.Video(format='mp4',label="Generated Video", width=720/2, height=1280/2),
|
33 |
+
title="ShortsIn",
|
34 |
+
description="Shorts generator"
|
35 |
+
)
|
36 |
+
|
37 |
+
app.launch(share=True)
|
38 |
#os.path.dirname(os.path.abspath(__file__))
|