|
import gradio as gr |
|
import random |
|
|
|
|
|
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" |
|
] |
|
|
|
|
|
def generate_title(blog_topic): |
|
words = blog_topic.lower().split() |
|
keyword = random.choice(words).capitalize() |
|
goal = blog_topic.title() |
|
power = random.choice(power_words) |
|
n = random.randint(5, 10) |
|
|
|
template = random.choice(templates) |
|
title = template.format(n=n, keyword=keyword, goal=goal, power=power) |
|
return title |
|
|
|
|
|
iface = gr.Interface( |
|
fn=generate_title, |
|
inputs=gr.Textbox(placeholder="Enter your blog topic or short paragraph...", label="Blog Topic"), |
|
outputs=gr.Textbox(label="SEO-Friendly Blog Title"), |
|
title="SEO-Friendly Blog Title Generator", |
|
description="Enter your blog topic or summary, and get a catchy SEO-optimized blog title in one click!" |
|
) |
|
|
|
|
|
iface.launch() |
|
|