Spaces:
Runtime error
Runtime error
| 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() | |