thak123 commited on
Commit
75ce96c
1 Parent(s): fecdaa0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -46,13 +46,14 @@ def predict():
46
 
47
  return features_dict
48
 
 
49
 
50
  #model_link = snapshot_download(repo_id="FFZG-cleopatra/Croatian-News-Classifier")
51
  model_link = hf_hub_download(repo_id="FFZG-cleopatra/Croatian-News-Classifier",filename = "pytorch_model.bin")
52
 
53
  # multitask_model.from_pretrained(, config="/media/gaurish/angela/projects/CroatianSlovenEnglishBert/i-got-u-brother-cleopatra-workshop/src/models/multitask_model_3ep/config.json")
54
- multitask_model.load_state_dict(torch.load(model_link, map_location=torch.device('cpu')))
55
- # device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
56
  # multitask_model.to(device)
57
  predictions = []
58
  features_dict = predict()
 
46
 
47
  return features_dict
48
 
49
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
50
 
51
  #model_link = snapshot_download(repo_id="FFZG-cleopatra/Croatian-News-Classifier")
52
  model_link = hf_hub_download(repo_id="FFZG-cleopatra/Croatian-News-Classifier",filename = "pytorch_model.bin")
53
 
54
  # multitask_model.from_pretrained(, config="/media/gaurish/angela/projects/CroatianSlovenEnglishBert/i-got-u-brother-cleopatra-workshop/src/models/multitask_model_3ep/config.json")
55
+ multitask_model.load_state_dict(torch.load(model_link, map_location=device))
56
+
57
  # multitask_model.to(device)
58
  predictions = []
59
  features_dict = predict()