Spaces:
Runtime error
Runtime error
File size: 1,877 Bytes
2678073 |
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 |
from agents import get_agents_and_tasks
from crewai import Crew
from utils import send_email_with_company_details, post_image_and_text
import streamlit as st
from dotenv import load_dotenv
load_dotenv()
# groq_api_key = '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'
def generate_bolg_and_video(title, url, token):
if token is not None:
agents, tasks = get_agents_and_tasks(is_token=True)
else:
agents, tasks = get_agents_and_tasks(is_token=False)
print(agents, '\n', tasks)
crew = Crew(
agents=agents,
tasks= tasks,
verbose = 2,
)
pairs = crew.kickoff(inputs={'topic':title, 'website':url, 'token':token})
print(1)
return 'video.mp4'
st.title("Blog and Video Generator")
title = st.text_input("Title")
url = st.text_input("Website URL")
email = st.text_input("Email ID")
# token = 'AQXZFWxVIyE0IJ3vopgzsuG0t4uSg9lUnVwLOTLOkEOKIU9hhswEYXOpEzEveBFCZdcRP4B3vN8gd_HI920LTH5LFbO9TVkHbtn8P2qE_GcwBq_1LzGw-HwatIY3zU7auWhxCMVYAXsklAJx6FAa_Sx_MUtaVcnA42K1vhYxSS7s0ecQq0Thsdod1KrK2_nA0YjMc1lSnQQy1WDiK0HGN2-2jbDt13NpJTkmZqEWm6G9BRplTkUSeSSqGNuLEGpuY0hd50GcRovkcqpz9ZfvqkeiKhAYPPDTAGDX7HO5VjtHTui3ZCFEXvEbAHzng116xDfNnBE8-fsig7c9HP6c06UmmN6evA'
token = None
if st.checkbox(label='post on linkedIn'):
token = st.text_input('Enter you LinkedIn access token')
if st.button("Generate"):
if title and url and email:
st.success("Blog and Video will be sent to your email.")
video_path = generate_bolg_and_video(title, url, token)
# st.write(video_path)
# with open('blog_post.md', 'r', encoding='latin-1') as f:
# blog = f.read()
# st.markdown(blog)
# st.video(video_path)
send_email_with_company_details(email, 'DIGIOTAI SOLUTIONS', title)
else:
st.error("Please provide all inputs.") |