File size: 1,051 Bytes
9195dc9
6e00735
 
d62bfcf
 
 
 
 
 
 
6e00735
1c0ed94
d62bfcf
 
 
 
 
 
6e00735
1c0ed94
 
88dddb9
1c0ed94
d62bfcf
 
248791d
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
from llama_cpp import Llama
import gradio as gr

# Load the model from Hugging Face Hub (ensure the GGUF model is downloaded or available locally)
llm = Llama(
    model_path="./TheBloke_Mistral-7B-Instruct-v0.1-GGUF.Q4_K_M.gguf",  # use correct filename here
    n_ctx=2048,
    n_threads=4,
    n_batch=64
)

def generate_description(business_name):
    prompt = (
        f"Write a professional and SEO-friendly Google My Business description for a business called '{business_name}'. "
        f"Keep it under 250 characters and highlight key services, trust, and quality. Use keywords like pizza, delivery, dine-in, or family-friendly."
    )
    response = llm(prompt=prompt, max_tokens=256, temperature=0.7)
    return response["choices"][0]["text"].strip()

gr.Interface(
    fn=generate_description,
    inputs=gr.Textbox(label="Business Name", placeholder="e.g. Pizza House"),
    outputs="text",
    title="GMB Description Generator",
    description="Generate SEO-optimized Google My Business descriptions using Mistral-7B-GGUF"
).launch()