Spaces:
Runtime error
Runtime error
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.") |