File size: 1,489 Bytes
160e5f8
 
 
5fabaf8
160e5f8
 
 
 
 
 
 
 
 
5fabaf8
160e5f8
 
5fabaf8
 
 
 
160e5f8
5fabaf8
160e5f8
 
 
5fabaf8
160e5f8
5fabaf8
 
 
 
 
160e5f8
 
5fabaf8
160e5f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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()