Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,18 @@
|
|
1 |
-
from
|
2 |
import gradio as gr
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
|
7 |
def generate_description(business_name):
|
8 |
-
prompt =
|
9 |
-
|
10 |
-
|
11 |
-
)
|
12 |
-
result = pipe(prompt, max_new_tokens=250, temperature=0.7)
|
13 |
-
return result[0]['generated_text'].strip()
|
14 |
|
15 |
gr.Interface(
|
16 |
fn=generate_description,
|
17 |
inputs=gr.Textbox(label="Business Name", placeholder="e.g. Pizza House"),
|
18 |
outputs="text",
|
19 |
-
title="GMB Description Generator",
|
20 |
-
description="Generate SEO-optimized
|
21 |
).launch()
|
|
|
1 |
+
from llama_cpp import Llama
|
2 |
import gradio as gr
|
3 |
|
4 |
+
# Load the model
|
5 |
+
llm = Llama(model_path="mistral-7b-instruct-v0.1.Q4_K_M.gguf", n_ctx=2048)
|
6 |
|
7 |
def generate_description(business_name):
|
8 |
+
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]"""
|
9 |
+
output = llm(prompt, max_tokens=200, temperature=0.7, stop=["</s>"])
|
10 |
+
return output['choices'][0]['text'].strip()
|
|
|
|
|
|
|
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 (Mistral)",
|
17 |
+
description="Generate SEO-optimized business descriptions using Mistral-7B-GGUF."
|
18 |
).launch()
|