dominguezdaniel commited on
Commit
1c0ed94
·
verified ·
1 Parent(s): f0a4457

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -16
app.py CHANGED
@@ -3,21 +3,15 @@ from transformers import pipeline
3
 
4
  generator = pipeline("text-generation", model="gpt2")
5
 
6
- def improve_description(description):
7
- prompt = f"Improve this Google Business Profile description. Make it clear, professional, and SEO-friendly:\n\n{description}\n\nImproved version:"
8
- result = generator(prompt, max_length=120, num_return_sequences=1)[0]['generated_text']
9
  return result
10
 
11
- with gr.Blocks() as demo:
12
- gr.Markdown("## Webpy - GMB Optimizer")
13
- gr.Markdown("Paste your Google Business Profile URL (optional):")
14
- url = gr.Textbox(label="Google My Business URL (optional)")
15
-
16
- gr.Markdown("Then paste your current description below:")
17
- input_desc = gr.Textbox(lines=4, label="Current Description", placeholder="e.g. We create affordable websites for small businesses in Colombia.")
18
- output = gr.Textbox(label="Improved Description")
19
-
20
- submit = gr.Button("Enhance")
21
- submit.click(fn=improve_description, inputs=input_desc, outputs=output)
22
-
23
- demo.launch()
 
3
 
4
  generator = pipeline("text-generation", model="gpt2")
5
 
6
+ def generate_description(business_name):
7
+ prompt = f"Write a professional and SEO-friendly Google My Business description for a business named '{business_name}'. Highlight its quality, trust, and services."
8
+ result = generator(prompt, max_length=100, num_return_sequences=1)[0]['generated_text']
9
  return result
10
 
11
+ gr.Interface(
12
+ fn=generate_description,
13
+ inputs=gr.Textbox(label="Business Name", placeholder="e.g. Webpy"),
14
+ outputs="text",
15
+ title="Google My Business Description Generator",
16
+ description="Enter your business name and get a professional, AI-enhanced description for your GMB profile.",
17
+ ).launch()