noddysnots commited on
Commit
9965443
Β·
verified Β·
1 Parent(s): 1e69485

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -7,7 +7,7 @@ import requests
7
  try:
8
  import flash_attn
9
  except ImportError:
10
- raise RuntimeError("Missing required dependency: flash_attn. Install with `pip install flash-attn`")
11
 
12
  # Load DeepSeek-R1 model with trust_remote_code enabled
13
  model_name = "deepseek-ai/DeepSeek-R1"
@@ -26,7 +26,6 @@ model = AutoModelForCausalLM.from_pretrained(
26
  # Use a text-generation pipeline
27
  generator = pipeline("text-generation", model=model, tokenizer=tokenizer, device=0 if torch.cuda.is_available() else -1)
28
 
29
-
30
  # 🎯 Function to extract interests from user input
31
  def extract_interests(text):
32
  prompt = f"Extract 3-5 relevant interests from this request: '{text}'. Focus on hobbies and product preferences."
@@ -37,7 +36,6 @@ def extract_interests(text):
37
 
38
  return interests.split(", ") # Convert to a list of keywords
39
 
40
-
41
  # 🎁 Web search for gift suggestions
42
  def search_gifts(interests):
43
  query = "+".join(interests)
@@ -53,7 +51,6 @@ def search_gifts(interests):
53
  "IndiaMart": indiamart_url
54
  }
55
 
56
-
57
  # 🎯 Main function for gift recommendation
58
  def recommend_gifts(text):
59
  if not text:
@@ -67,7 +64,6 @@ def recommend_gifts(text):
67
  "Gift Suggestions": links
68
  }
69
 
70
-
71
  # 🎨 Gradio UI for easy interaction
72
  demo = gr.Interface(
73
  fn=recommend_gifts,
 
7
  try:
8
  import flash_attn
9
  except ImportError:
10
+ raise RuntimeError("Missing required dependency: flash_attn. Install with `pip install flash-attn --no-build-isolation`")
11
 
12
  # Load DeepSeek-R1 model with trust_remote_code enabled
13
  model_name = "deepseek-ai/DeepSeek-R1"
 
26
  # Use a text-generation pipeline
27
  generator = pipeline("text-generation", model=model, tokenizer=tokenizer, device=0 if torch.cuda.is_available() else -1)
28
 
 
29
  # 🎯 Function to extract interests from user input
30
  def extract_interests(text):
31
  prompt = f"Extract 3-5 relevant interests from this request: '{text}'. Focus on hobbies and product preferences."
 
36
 
37
  return interests.split(", ") # Convert to a list of keywords
38
 
 
39
  # 🎁 Web search for gift suggestions
40
  def search_gifts(interests):
41
  query = "+".join(interests)
 
51
  "IndiaMart": indiamart_url
52
  }
53
 
 
54
  # 🎯 Main function for gift recommendation
55
  def recommend_gifts(text):
56
  if not text:
 
64
  "Gift Suggestions": links
65
  }
66
 
 
67
  # 🎨 Gradio UI for easy interaction
68
  demo = gr.Interface(
69
  fn=recommend_gifts,