Hanna Hjelmeland commited on
Commit
483b69e
1 Parent(s): 8219eaa
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -52,7 +52,8 @@ def classify_text(test_text, selected_model):
52
  return dict(zip(categories, map(float,probabilities)))
53
  elif selected_model == 'Model 3':
54
  models = [f_30_40_model, f_40_55_model, m_30_40_model, m_40_55_model]
55
- performance_labels = []
 
56
  inputs = tokenizer(test_text, return_tensors="pt")
57
 
58
  for model in models:
@@ -62,12 +63,8 @@ def classify_text(test_text, selected_model):
62
  probabilities = torch.softmax(logits, dim=1)
63
 
64
  predicted_class = torch.argmax(probabilities, dim=1).item()
65
- performance_labels = ['Lite god', 'Nokså god', 'God']
66
  predicted_performance = performance_labels[predicted_class]
67
-
68
- class_labels = model.config.id2label
69
- predicted_label = class_labels[predicted_class]
70
- performance_labels.append(predicted_label)
71
 
72
  return dict(zip(categories, map(float,performance_labels)))
73
 
 
52
  return dict(zip(categories, map(float,probabilities)))
53
  elif selected_model == 'Model 3':
54
  models = [f_30_40_model, f_40_55_model, m_30_40_model, m_40_55_model]
55
+ predicted_labels = []
56
+ performance_labels = ['Lite god', 'Nokså god', 'God']
57
  inputs = tokenizer(test_text, return_tensors="pt")
58
 
59
  for model in models:
 
63
  probabilities = torch.softmax(logits, dim=1)
64
 
65
  predicted_class = torch.argmax(probabilities, dim=1).item()
 
66
  predicted_performance = performance_labels[predicted_class]
67
+ predicted_labels.append(predicted_performance)
 
 
 
68
 
69
  return dict(zip(categories, map(float,performance_labels)))
70