File size: 813 Bytes
9195dc9
6e00735
 
9195dc9
 
6e00735
1c0ed94
9195dc9
 
 
6e00735
1c0ed94
 
88dddb9
1c0ed94
9195dc9
 
248791d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from llama_cpp import Llama
import gradio as gr

# Load the model
llm = Llama(model_path="mistral-7b-instruct-v0.1.Q4_K_M.gguf", n_ctx=2048)

def generate_description(business_name):
    prompt = f"""<s>[INST] Write a commercial and SEO-optimized Google My Business description for a business called "{business_name}". Highlight its services, quality, and trust. Keep it under 250 characters. [/INST]"""
    output = llm(prompt, max_tokens=200, temperature=0.7, stop=["</s>"])
    return output['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 (Mistral)",
    description="Generate SEO-optimized business descriptions using Mistral-7B-GGUF."
).launch()