Fredaaaaaa commited on
Commit
ca31dd6
·
verified ·
1 Parent(s): 747baac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -9,6 +9,10 @@ import re
9
  from sklearn.utils.class_weight import compute_class_weight
10
  import numpy as np
11
 
 
 
 
 
12
  # Download label encoder from Hugging Face Hub
13
  label_encoder_path = hf_hub_download(repo_id="Fredaaaaaa/hybrid_model", filename="label_encoder.pkl")
14
  with open(label_encoder_path, 'rb') as f:
@@ -44,6 +48,8 @@ loss_fn = torch.nn.CrossEntropyLoss(weight=class_weights)
44
  # The rest of your code follows here...
45
 
46
 
 
 
47
  # Function to properly clean drug names
48
  def clean_drug_name(drug_name):
49
  if not drug_name:
 
9
  from sklearn.utils.class_weight import compute_class_weight
10
  import numpy as np
11
 
12
+ # ✅ Device setup
13
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
14
+ print(f"Using device: {device}")
15
+
16
  # Download label encoder from Hugging Face Hub
17
  label_encoder_path = hf_hub_download(repo_id="Fredaaaaaa/hybrid_model", filename="label_encoder.pkl")
18
  with open(label_encoder_path, 'rb') as f:
 
48
  # The rest of your code follows here...
49
 
50
 
51
+
52
+
53
  # Function to properly clean drug names
54
  def clean_drug_name(drug_name):
55
  if not drug_name: