Sleepyp00 commited on
Commit
6f22d2e
·
1 Parent(s): 82ef100
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -19,8 +19,6 @@ classifier = joblib.load(model_dir + "/finetuned_classifier.pkl")
19
  embedding_model = mr.get_model("news_embedding", version = 1)
20
  model_dir = embedding_model.download()
21
  embedding_model = joblib.load(model_dir + "/news_embedding.pkl")
22
- embedding_model = embedding_model.to(device)
23
-
24
 
25
  index_to_category = {
26
  0:"Polititcs",
@@ -59,7 +57,7 @@ The input is currently truncated at around 400 words so make sure to include the
59
 
60
 
61
  def predict(text):
62
- embedding = embedding_model.encode([text])
63
  with torch.no_grad():
64
  embedding = torch.tensor(embedding, device=device, dtype=torch.float32)
65
  probs = classifier.probabilities(embedding).cpu().numpy()
 
19
  embedding_model = mr.get_model("news_embedding", version = 1)
20
  model_dir = embedding_model.download()
21
  embedding_model = joblib.load(model_dir + "/news_embedding.pkl")
 
 
22
 
23
  index_to_category = {
24
  0:"Polititcs",
 
57
 
58
 
59
  def predict(text):
60
+ embedding = embedding_model.encode([text], device = device)
61
  with torch.no_grad():
62
  embedding = torch.tensor(embedding, device=device, dtype=torch.float32)
63
  probs = classifier.probabilities(embedding).cpu().numpy()