Prudvireddy commited on
Commit
f636163
1 Parent(s): da6bfe6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -32
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
- def generate_video(topic, grow_api_key, stability_ai_api_key):
9
- os.environ['GROQ_API_KEY'] = grow_api_key
10
- os.environ['STABILITY_AI_API_KEY'] = stability_ai_api_key
11
-
12
- crew = Crew(
13
- agents=[script_agent, image_descriptive_agent, img_speech_generating_agent, editor],
14
- tasks=[content_generation_task, story_writing_task, img_text_task, img_generation_task,speech_generation_task,make_video_task],
15
- process = Process.sequential,
16
- # cache = True,
17
- memory=True,
18
- verbose=2
19
- )
20
- crew.kickoff(inputs={'topic': topic})
21
- return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'outputs/final_video/final_video.mp4')
22
-
23
- app = gr.Interface(
24
- fn=generate_video,
25
- inputs=['text', 'text', 'text'],
26
- # outputs=gr.Video(value=os.path.join('outputs/final_video/video.mp4'),label="Generated Video", width=720/2, height=1280/2),
27
- outputs = gr.Video(format='mp4',label="Generated Video", width=720/2, height=1280/2),
28
- title="ShortsIn",
29
- description="Shorts generator"
30
- )
31
-
32
- app.launch(share=True)
 
 
 
 
 
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__))