Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,26 @@
|
|
1 |
from llama_cpp import Llama
|
2 |
import gradio as gr
|
3 |
|
4 |
-
# Load the model
|
5 |
-
llm = Llama(
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
def generate_description(business_name):
|
8 |
-
prompt =
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
gr.Interface(
|
13 |
fn=generate_description,
|
14 |
inputs=gr.Textbox(label="Business Name", placeholder="e.g. Pizza House"),
|
15 |
outputs="text",
|
16 |
-
title="GMB Description Generator
|
17 |
-
description="Generate SEO-optimized
|
18 |
).launch()
|
|
|
1 |
from llama_cpp import Llama
|
2 |
import gradio as gr
|
3 |
|
4 |
+
# Load the model from Hugging Face Hub (ensure the GGUF model is downloaded or available locally)
|
5 |
+
llm = Llama(
|
6 |
+
model_path="./TheBloke_Mistral-7B-Instruct-v0.1-GGUF.Q4_K_M.gguf", # use correct filename here
|
7 |
+
n_ctx=2048,
|
8 |
+
n_threads=4,
|
9 |
+
n_batch=64
|
10 |
+
)
|
11 |
|
12 |
def generate_description(business_name):
|
13 |
+
prompt = (
|
14 |
+
f"Write a professional and SEO-friendly Google My Business description for a business called '{business_name}'. "
|
15 |
+
f"Keep it under 250 characters and highlight key services, trust, and quality. Use keywords like pizza, delivery, dine-in, or family-friendly."
|
16 |
+
)
|
17 |
+
response = llm(prompt=prompt, max_tokens=256, temperature=0.7)
|
18 |
+
return response["choices"][0]["text"].strip()
|
19 |
|
20 |
gr.Interface(
|
21 |
fn=generate_description,
|
22 |
inputs=gr.Textbox(label="Business Name", placeholder="e.g. Pizza House"),
|
23 |
outputs="text",
|
24 |
+
title="GMB Description Generator",
|
25 |
+
description="Generate SEO-optimized Google My Business descriptions using Mistral-7B-GGUF"
|
26 |
).launch()
|