ElPremOoO commited on
Commit
7aa3527
·
verified ·
1 Parent(s): 6c75a0d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -17,7 +17,7 @@ app = Flask(__name__)
17
  tokenizer = RobertaTokenizer.from_pretrained("microsoft/codebert-base")
18
  torch.serialization.add_safe_globals([RobertaForSequenceClassification])
19
 
20
- model = torch.load("model.pth", map_location=torch.device('cpu'), weights_only=False) # Load the trained model
21
 
22
  # Ensure the model is in evaluation mode
23
  model.eval()
@@ -34,7 +34,7 @@ def predict():
34
  print("Received code:", request.get_json()["code"])
35
  code = request.get_json()["code"]
36
  # Load saved weights and config
37
- checkpoint = torch.load("codebert_vulnerability_scorer.pth")
38
  config = RobertaConfig.from_dict(checkpoint['config'])
39
 
40
  # Rebuild the model with correct architecture
 
17
  tokenizer = RobertaTokenizer.from_pretrained("microsoft/codebert-base")
18
  torch.serialization.add_safe_globals([RobertaForSequenceClassification])
19
 
20
+ model = torch.load("codebert_readability_scorer.pth", map_location=torch.device('cpu'), weights_only=False) # Load the trained model
21
 
22
  # Ensure the model is in evaluation mode
23
  model.eval()
 
34
  print("Received code:", request.get_json()["code"])
35
  code = request.get_json()["code"]
36
  # Load saved weights and config
37
+ checkpoint = torch.load("codebert_readability_scorer.pth")
38
  config = RobertaConfig.from_dict(checkpoint['config'])
39
 
40
  # Rebuild the model with correct architecture