dominguezdaniel commited on
Commit
9195dc9
·
verified ·
1 Parent(s): 248791d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -1,21 +1,18 @@
1
- from transformers import pipeline
2
  import gradio as gr
3
 
4
- # Ensure accelerate is installed: pip install accelerate
5
- pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-V3-0324", trust_remote_code=True)
6
 
7
  def generate_description(business_name):
8
- prompt = (
9
- f"Write a complete, commercial and SEO-optimized Google My Business description for a business called '{business_name}'. "
10
- "Highlight services, quality, trust, and key features in under 250 characters."
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 Google My Business descriptions using DeepSeek."
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()