Spaces:
Runtime error
Runtime error
from remove_astricks import remove_ast | |
from load_model import call_palm | |
from keywords_generation import keywords_generator, filter_keywords, process_keywords | |
from idea_generation import ideas_generator, filter_ideas | |
from outline_generation import outlines_generator, filtered_outlines | |
from article_generation import full_article, rephrase | |
from product_description_generation import product_description_gen | |
from x_thread_generation import X_thread_gen, X_thread_gen_intro | |
from linkedin_post_generation import linkedIn_post_gen | |
from insta_image_caption_generation import img2text, generate_InstaCap | |
from facebook_post_generation import facebook_post_gen | |
from facebook_ads_generation import facebook_ads_gen | |
from facebook_campaign import facbook_camp_gen, social_media_camp_gen | |
from linkedIn_ads_generation import linkedIn_ads_gen | |
from email_marketing_campaigns_generation import email_marketing_campaigns_gen | |
from workout_plan_generation import workout_plan_gen | |
from landing_page_generation import landing_page_gen | |
from blog_post_generation import blog_post_gen | |
from x_bio_creation import x_bio_gen | |
from x_retweet_commenting_generation import x_retweet_commenting_gen | |
from article_conversion_to_x_thread import article_to_x_thread_gen | |
from x_campaign_generation import x_camp_gen | |
from blog_ideas_generation import blog_idea_gen | |
from blog_ideas_description_generation import blog_idea_desc_gen | |
from blog_post_tags_generation import blog_tags_gen | |
import X_content_creation | |
import blog_content_creation | |
import meta_content_creation | |
import email_writer | |
import streamlit as st | |
from dotenv import load_dotenv, find_dotenv | |
import os | |
import time | |
load_dotenv(find_dotenv()) | |
google_api_key = os.environ['OPENAI_API_KEY'] | |
if __name__ == '__main__': | |
llm = call_palm(google_api_key) | |
tone_of_voice_list = ('Excited', 'Professional', 'Encouraging', 'Funny', 'Dramatic', 'Witty', 'Sarcastic', 'Engaging', 'Creative') | |
creativity_list = ('Original', 'Creative', 'Visionary') | |
with st.sidebar: | |
st.image('Logo.png') | |
choice = st.radio("Navigation", ["Articles and Blogs", "Product Description", "LinkedIn Post", "LinkedIn Ads", "Gym Workout Plan", "Landing Page", "X Content Creation", "Meta Content", "Emails"]) | |
st.info("Generate your Content with Feather AI in Seconds..") | |
if choice == 'Product Description': | |
product_name = st.text_input('Product Name') | |
product_desc = st.text_area('Product Description') | |
tone_of_voice = st.selectbox('Tone of Voice', tone_of_voice_list) | |
if product_name and product_desc and tone_of_voice: | |
if st.button('Generate'): | |
product_description = product_description_gen(product_name, product_desc, tone_of_voice, llm) | |
st.markdown(product_description) | |
elif choice == 'LinkedIn Post': | |
topic = st.text_input("Topic") | |
tone_of_voice = st.selectbox('Tone of Voice', tone_of_voice_list) | |
if topic and tone_of_voice: | |
if st.button('Generate'): | |
linkedIn_post = linkedIn_post_gen(topic, tone_of_voice, llm) | |
st.markdown(linkedIn_post) | |
elif choice == "LinkedIn Ads": | |
product_name = st.text_input("Product Name") | |
product_desc = st.text_area("Product Description") | |
target_audience = st.text_input("Target Audience") | |
target_keywords = st.text_input("Target Keywords") | |
if product_name and product_desc and target_audience and target_keywords: | |
if st.button("Generate"): | |
linkedIn_ad = linkedIn_ads_gen(product_name, product_desc, target_audience, target_keywords, llm) | |
st.markdown(linkedIn_ad) | |
elif choice == "Gym Workout Plan": | |
fitness_level_list = ('Beginner', 'Intermediate', 'Advanced', 'Elite') | |
health_consd_list = ('Cutting Phase', 'Bulking Phase', 'Maintenance Phase', 'Lean Muscle Gain') | |
routine_list = ('Bro Split', 'Push Pull Leg', 'Upper and Lower', 'Full Body') | |
fitness_level = st.selectbox('Fitness Level', fitness_level_list) | |
days = st.slider('Avaliable Days Per Week',1,7,4) | |
hours = st.slider('Avaliable Hours Per Day',1,6,2) | |
health_consd = st.selectbox('Health Considerations',health_consd_list) | |
routine = st.selectbox("Preferred Routine", routine_list) | |
my_goals = st.text_input('Goals') | |
if fitness_level and days and hours and health_consd and routine and my_goals: | |
if st.button('Generate'): | |
workout_plan = workout_plan_gen(my_goals, fitness_level, days, hours, health_consd, routine, llm) | |
st.markdown(workout_plan) | |
elif choice == "Landing Page": | |
#product_name = st.text_input('Product Name') | |
#product_desc = st.text_area('Description') | |
#target_audience = st.text_input('Target Audience') | |
#goal = st.text_input('Goal') | |
st.title('Not Working') | |
#if product_name and product_desc and target_audience and goal: | |
#if st.button('Generate'): | |
#landing_page = landing_page_gen(product_name, product_desc, target_audience, goal, llm) | |
#st.markdown(landing_page) | |
elif choice == 'X Content Creation': | |
X_content = X_content_creation.X_Generator(llm) | |
x_choices_list = ('X thread', 'X Retweet Commenting', 'X Campaign', 'X Bio Creation', 'Article Conversion to X Thread') | |
x_choices = st.selectbox('Choose X Template', x_choices_list) | |
if x_choices == x_choices_list[0]: | |
topic = st.text_input('Topic') | |
num_tweets = st.slider('Number of Thread tweet', 1,10,5) | |
tone_of_voice = st.selectbox('Tone of Voice', tone_of_voice_list) | |
if topic and num_tweets and tone_of_voice: | |
if st.button('Generate'): | |
X_thread = X_content.X_thread_gen(topic, num_tweets, tone_of_voice) | |
intro = X_content.X_thread_gen_intro(topic, X_thread, tone_of_voice) | |
st.markdown(intro) | |
st.markdown(X_thread) | |
elif x_choices == x_choices_list[1]: | |
tweet = st.text_area('Tweet') | |
tone_of_voice = st.selectbox('Tone of voice', tone_of_voice_list) | |
if tweet and tone_of_voice: | |
if st.button('Generate'): | |
x_retweet_comment = X_content.x_retweet_commenting_gen(tweet, tone_of_voice) | |
st.markdown(x_retweet_comment) | |
elif x_choices == x_choices_list[2]: | |
product_name = st.text_input('Product Name') | |
product_desc = st.text_area('Product Description') | |
goal = st.text_input('Goal') | |
if product_name and product_desc and goal: | |
if st.button('Generate'): | |
x_camp = X_content.x_camp_gen(product_name, product_desc, goal) | |
st.markdown(x_camp) | |
elif x_choices == x_choices_list[3]: | |
info = st.text_area('info') | |
tone_of_voice = st.selectbox('Tone of voice', tone_of_voice_list) | |
if info and tone_of_voice: | |
if st.button('Generate'): | |
x_bio = X_content.x_bio_gen(info, tone_of_voice, llm) | |
st.markdown(x_bio) | |
elif x_choices == x_choices_list[4]: | |
article = st.text_area('Article') | |
if article: | |
if st.button('Generate'): | |
article_to_x_thread = X_content.article_to_x_thread_gen(article) | |
st.markdown(article_to_x_thread) | |
elif choice == 'Articles and Blogs': | |
blog_content = blog_content_creation.blog_content_generation(llm) | |
blog_choices_list = ('Article Writer', 'Blog Post', 'Blog Ideas', 'Blog Tags', 'Blog Ideas description') | |
blog_choices = st.selectbox('Choose Blog Template', blog_choices_list) | |
if blog_choices == blog_choices_list[0]: | |
topic = st.text_input('Topic') | |
tone_of_voice = st.selectbox('Tone of Voice', tone_of_voice_list) | |
if topic: | |
keywords = keywords_generator(topic, llm) | |
filtered_keywords = filter_keywords(keywords) | |
formatted_keywords = process_keywords(filtered_keywords) | |
st.markdown('### Generated Keywords:\n') | |
st.markdown(formatted_keywords) | |
formatted_keywords = remove_ast(formatted_keywords) | |
idea_numbers = st.slider("How many ideas you want?",1,10,5) | |
ideas = ideas_generator(topic, formatted_keywords, llm, tone_of_voice, idea_numbers) | |
filtered_ideas = filter_ideas(ideas) | |
index = 1 | |
st.markdown("### Generated Ideas:\n") | |
for idea in filtered_ideas: | |
st.markdown(f"{index} - {idea}") | |
index+=1 | |
st.text('\n') | |
num_idea = st.text_input("Choose the idea you want by number") | |
if num_idea: | |
num_idea = int(num_idea) | |
idea = filtered_ideas[num_idea-1] | |
idea = remove_ast(idea) | |
outline = outlines_generator(idea,formatted_keywords, llm) | |
st.text('\n') | |
st.markdown("### Generated Outline:\n") | |
st.markdown(outline) | |
outline_list = filtered_outlines(outline) | |
if st.button('Generate'): | |
article = full_article(idea, outline_list, tone_of_voice, llm) | |
st.markdown("# Your Article:\n") | |
st.markdown(f"{idea}\n") | |
st.markdown('\n\n'.join(article)) | |
st.text('\n\n') | |
num_art_chars = len('\n'.join(article)) | |
num_art_words = len('\n'.join(article).split(' ')) | |
st.markdown(f"{num_art_chars} Characters") | |
st.markdown(f"{num_art_words} Words") | |
elif blog_choices == blog_choices_list[1]: | |
topic = st.text_input('Topic') | |
if topic: | |
if st.button('Generate'): | |
blog_post = blog_content.blog_post_gen(topic) | |
st.markdown(blog_post) | |
elif blog_choices == blog_choices_list[2]: | |
topic = st.text_input('Topic') | |
if topic: | |
if st.button('Generate'): | |
blog_idea = blog_content.blog_idea_gen(topic) | |
st.markdown(blog_idea) | |
elif blog_choices == blog_choices_list[4]: | |
blog = st.text_area('Blog') | |
if blog: | |
if st.button('Generate'): | |
blog_idea_desc = blog_content.blog_idea_desc_gen(blog) | |
st.markdown(blog_idea_desc) | |
elif blog_choices == blog_choices_list[3]: | |
blog = st.text_area('Blog') | |
if blog: | |
if st.button('Generate'): | |
blog_tags = blog_content.blog_tags_gen(blog) | |
st.markdown(blog_tags) | |
elif choice == 'Meta Content': | |
meta_content_gen = meta_content_creation.meta_content_generation(llm) | |
meta_choices_list = ('Facebook Post', 'Facebook Ads', 'Facebook Campaign', 'Insta Image Captioning') | |
meta_choices = st.selectbox('Choose Blog Template', meta_choices_list) | |
if meta_choices == meta_choices_list[0]: | |
topic = st.text_input("Topic") | |
tone_of_voice = st.selectbox('Tone of Voice', tone_of_voice_list) | |
if topic and tone_of_voice: | |
if st.button('Generate'): | |
facebook_post = meta_content_gen.facebook_post_gen(tone_of_voice, topic) | |
st.markdown(facebook_post) | |
elif meta_choices == meta_choices_list[1]: | |
product_name = st.text_input('Product Name') | |
product_desc = st.text_area('Description') | |
targeted_audience = st.text_input('Target Audience') | |
plans_proms = st.text_input('Plan and Promotions') | |
tone_of_voice = st.selectbox('Tone of Voice', tone_of_voice_list) | |
creativity = st.selectbox('Creativity', creativity_list) | |
if product_name and product_desc and tone_of_voice: | |
if st.button('Generate'): | |
face_ad__prom = meta_content_gen.facebook_ads_gen(product_name, product_desc, tone_of_voice, targeted_audience, plans_proms) | |
st.markdown(face_ad__prom) | |
elif meta_choices == meta_choices_list[2]: | |
product_name = st.text_input('Product Name') | |
product_desc = st.text_area('Product Description') | |
days = st.selectbox('Days', (10,15,20,25,30)) | |
goal = st.text_input('Goal') | |
if product_name and product_desc and goal and days: | |
if st.button('Generate'): | |
facbook_camp = meta_content_gen.facbook_camp_gen(product_name, product_desc, days, goal) | |
st.markdown(facbook_camp) | |
elif meta_choices == meta_choices_list[3]: | |
uploaded_file = st.file_uploader("Choose an image...", type=["jpg","jpeg","png"]) | |
if uploaded_file is not None: | |
bytes_data = uploaded_file.getvalue() | |
with open(uploaded_file.name, "wb") as file: | |
file.write(bytes_data) | |
st.image(uploaded_file, caption="Uploaded image", | |
use_column_width=True, width=500) | |
scenario = meta_content_gen.img2text(uploaded_file.name) | |
st.subheader("Image Scenario:") | |
with st.expander("scenario"): | |
st.write(scenario) | |
tone_of_voice = st.selectbox('Tone of Voice', tone_of_voice_list) | |
form = st.selectbox('Caption Form', ('Short Form', 'Medium Form', 'Long Form')) | |
if st.button('Generate'): | |
st.subheader("Generated Instagram Image according to the scenario:") | |
instaCap = meta_content_gen.generate_InstaCap(scenario, tone_of_voice, form) | |
st.markdown(instaCap) | |
elif choice == 'Emails': | |
email_content_gen = email_writer.email_writing(llm) | |
email_choices_list = ('Email Writer', 'Email Marketing Campaign') | |
email_choices = st.selectbox('Choose Emai Template', email_choices_list) | |
if email_choices == email_choices_list[0]: | |
recipient = st.text_input('Recipient') | |
recipient_position = st.text_input('Recipient Position') | |
sender_name = st.text_input('Sender Name') | |
position_sender = st.text_input('Sender Position') | |
description = st.text_area('Description') | |
if recipient and recipient_position and sender_name and position_sender and description: | |
if st.button('Generate'): | |
email = email_content_gen.email_gen(recipient, recipient_position, sender_name, position_sender, description) | |
email_subject = email_content_gen.email_subject_gen(email) | |
st.markdown(f'Subject: {email_subject}') | |
st.markdown(email) | |
elif email_choices == email_choices_list[1]: | |
product_name = st.text_input("Product Name") | |
product_description = st.text_area("Product Description") | |
target_audience = st.text_input("Target Audience") | |
goal = st.text_input("Goal") | |
if product_name and product_description and target_audience and goal: | |
if st.button("Generate"): | |
email_marketing_camp = email_content_gen.email_marketing_campaigns_gen(product_name, product_description, target_audience, goal) | |
st.markdown(email_marketing_camp) | |