Amandeep01 commited on
Commit
5fabaf8
·
verified ·
1 Parent(s): bf2953d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import random
3
 
4
- # Power words and templates (tu customize bhi kar sakta hai)
5
  power_words = ["Ultimate", "Proven", "Effective", "Powerful", "Easy", "Best", "Top", "Quick", "Free", "Insane", "Smart"]
6
  templates = [
7
  "Top {n} {keyword} Tips for {goal}",
@@ -11,24 +11,26 @@ templates = [
11
  "{n} Secrets About {keyword} You Should Know"
12
  ]
13
 
 
14
  def generate_title(blog_topic):
15
  words = blog_topic.lower().split()
16
- keyword = random.choice(words).capitalize()
17
- goal = blog_topic.title()
18
- power = random.choice(power_words)
19
- n = random.randint(5, 10)
20
 
21
- template = random.choice(templates)
22
  title = template.format(n=n, keyword=keyword, goal=goal, power=power)
23
  return title
24
 
25
- # Gradio Interface
26
  iface = gr.Interface(
27
- fn=generate_title,
28
- inputs=gr.Textbox(placeholder="Enter your blog topic or short paragraph...", label="Blog Topic"),
29
- outputs=gr.Textbox(label="SEO-Friendly Blog Title"),
30
- title="📝 SEO-Friendly Blog Title Generator",
31
- description="Enter your blog topic or summary, and get a catchy SEO-optimized blog title in one click!"
32
  )
33
 
 
34
  iface.launch()
 
1
  import gradio as gr
2
  import random
3
 
4
+ # List of power words (SEO boost)
5
  power_words = ["Ultimate", "Proven", "Effective", "Powerful", "Easy", "Best", "Top", "Quick", "Free", "Insane", "Smart"]
6
  templates = [
7
  "Top {n} {keyword} Tips for {goal}",
 
11
  "{n} Secrets About {keyword} You Should Know"
12
  ]
13
 
14
+ # Function to generate SEO title
15
  def generate_title(blog_topic):
16
  words = blog_topic.lower().split()
17
+ keyword = random.choice(words).capitalize() # Select random keyword
18
+ goal = blog_topic.title() # Capitalize the goal part of the input
19
+ power = random.choice(power_words) # Select random power word
20
+ n = random.randint(5, 10) # Random number of tips (5-10)
21
 
22
+ template = random.choice(templates) # Random title template
23
  title = template.format(n=n, keyword=keyword, goal=goal, power=power)
24
  return title
25
 
26
+ # Gradio Interface Setup
27
  iface = gr.Interface(
28
+ fn=generate_title, # Function to call on input
29
+ inputs=gr.Textbox(placeholder="Enter your blog topic or short paragraph...", label="Blog Topic"), # Input box
30
+ outputs=gr.Textbox(label="SEO-Friendly Blog Title"), # Output box
31
+ title="SEO-Friendly Blog Title Generator", # Title of the interface
32
+ description="Enter your blog topic or summary, and get a catchy SEO-optimized blog title in one click!" # Description
33
  )
34
 
35
+ # Launch the app
36
  iface.launch()