Cicciokr commited on
Commit
b07ff6a
·
verified ·
1 Parent(s): c67491c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -5,7 +5,7 @@ import builtins
5
  import os
6
  import json
7
 
8
- DATA_FILE = "data.json"
9
 
10
  def load_data():
11
  """Carica i dati salvati (token e frasi) dal file JSON."""
@@ -28,6 +28,7 @@ def save_token_and_phrase(token, phrase):
28
 
29
  def get_valid_predictions(sentence, max_attempts=3, top_k=5):
30
  """Verifica se la frase è già salvata e usa il token corrispondente."""
 
31
  if sentence in data["phrases"]:
32
  return [{"token_str": data["phrases"][sentence], "score": 1.0, "sequence": sentence.replace("[MASK]", data["phrases"][sentence])}]
33
 
 
5
  import os
6
  import json
7
 
8
+ DATA_FILE = "./data.json"
9
 
10
  def load_data():
11
  """Carica i dati salvati (token e frasi) dal file JSON."""
 
28
 
29
  def get_valid_predictions(sentence, max_attempts=3, top_k=5):
30
  """Verifica se la frase è già salvata e usa il token corrispondente."""
31
+ data = load_data()
32
  if sentence in data["phrases"]:
33
  return [{"token_str": data["phrases"][sentence], "score": 1.0, "sequence": sentence.replace("[MASK]", data["phrases"][sentence])}]
34