santhoshraghu commited on
Commit
b08c22b
·
verified ·
1 Parent(s): f6e8f8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -49,14 +49,15 @@ collection_name = "ks_collection_1.5BE"
49
 
50
 
51
 
 
 
52
  local_embedding = HuggingFaceEmbeddings(
53
  model_name="Alibaba-NLP/gte-Qwen2-1.5B-instruct",
54
  model_kwargs={
55
  "trust_remote_code": True,
56
- "device": "gpu" # or "cuda:0"
57
  }
58
  )
59
-
60
  print(" Qwen2-1.5B local embedding model loaded.")
61
 
62
 
 
49
 
50
 
51
 
52
+ device = "cuda" if torch.cuda.is_available() else "cpu"
53
+
54
  local_embedding = HuggingFaceEmbeddings(
55
  model_name="Alibaba-NLP/gte-Qwen2-1.5B-instruct",
56
  model_kwargs={
57
  "trust_remote_code": True,
58
+ "device": device
59
  }
60
  )
 
61
  print(" Qwen2-1.5B local embedding model loaded.")
62
 
63