elselse commited on
Commit
ad4dbf8
·
verified ·
1 Parent(s): f5dfdb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -12,16 +12,11 @@ model.eval()
12
  with open("child_to_parent_mapping.json", "r") as f:
13
  child_to_ancestor = json.load(f)
14
 
15
- with open(f"{model_path}/config.json", "r") as f:
16
- config = json.load(f)
17
- id2label = config["id2label"]
18
 
19
- # Fonction d'extraction pour simuler une entrée formatée
20
  def extract_commit_text_hg_style(input_text):
21
- # Ici, on pourrait simuler un vrai patch ou commit. Pour l’instant, on prend l’entrée brute.
22
  return input_text.strip()
23
 
24
- # Fonction Gradio de prédiction
25
  def predict_ancestors(input_text):
26
  text = extract_commit_text_hg_style(input_text)
27
  inputs = tokenizer(text, return_tensors="pt", truncation=True, padding="max_length", max_length=512)
 
12
  with open("child_to_parent_mapping.json", "r") as f:
13
  child_to_ancestor = json.load(f)
14
 
15
+ id2label = model.config.id2label
 
 
16
 
 
17
  def extract_commit_text_hg_style(input_text):
 
18
  return input_text.strip()
19
 
 
20
  def predict_ancestors(input_text):
21
  text = extract_commit_text_hg_style(input_text)
22
  inputs = tokenizer(text, return_tensors="pt", truncation=True, padding="max_length", max_length=512)