import gradio as gr import random # List of power words (SEO boost) power_words = ["Ultimate", "Proven", "Effective", "Powerful", "Easy", "Best", "Top", "Quick", "Free", "Insane", "Smart"] templates = [ "Top {n} {keyword} Tips for {goal}", "{n} {power} Ways to {goal} with {keyword}", "How to {goal} Using {keyword}", "The {power} Guide to {goal} with {keyword}", "{n} Secrets About {keyword} You Should Know" ] # Function to generate SEO title def generate_title(blog_topic): words = blog_topic.lower().split() keyword = random.choice(words).capitalize() # Select random keyword goal = blog_topic.title() # Capitalize the goal part of the input power = random.choice(power_words) # Select random power word n = random.randint(5, 10) # Random number of tips (5-10) template = random.choice(templates) # Random title template title = template.format(n=n, keyword=keyword, goal=goal, power=power) return title # Gradio Interface Setup iface = gr.Interface( fn=generate_title, # Function to call on input inputs=gr.Textbox(placeholder="Enter your blog topic or short paragraph...", label="Blog Topic"), # Input box outputs=gr.Textbox(label="SEO-Friendly Blog Title"), # Output box title="SEO-Friendly Blog Title Generator", # Title of the interface description="Enter your blog topic or summary, and get a catchy SEO-optimized blog title in one click!" # Description ) # Launch the app iface.launch()