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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
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)