SimpleFrog commited on
Commit
eaa333d
·
verified ·
1 Parent(s): 8537a08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -93,11 +93,13 @@ if start_eval:
93
  device_map="auto", # ou device=0 si tu veux forcer le GPU
94
  torch_dtype=torch.float16 # optionnel mais plus léger
95
  )
96
-
 
97
  def postprocess_with_llm(text):
98
  prompt = f"Ce texte est issue d'une translation vocal. L'enregistrement est tiré d'une inspection détaillé de pont et comprend du vocabulaire technique associé. Corriges les éventuelles erreurs de translation : {text}"
99
  result = postproc_pipe(prompt, max_new_tokens=256)[0]["generated_text"]
100
  return result.strip()
 
101
 
102
  # 🔹 Préparer WER metric
103
  wer_metric = evaluate.load("wer")
@@ -125,7 +127,9 @@ if start_eval:
125
 
126
  # === Post-processing conditionnel ===
127
  if "Post-processing" in model_option:
 
128
  postprocessed_prediction = postprocess_with_llm(prediction)
 
129
  final_prediction = postprocessed_prediction
130
  else:
131
  postprocessed_prediction = "-"
 
93
  device_map="auto", # ou device=0 si tu veux forcer le GPU
94
  torch_dtype=torch.float16 # optionnel mais plus léger
95
  )
96
+ st.success("✅ Modèle Mistral chargé.")
97
+
98
  def postprocess_with_llm(text):
99
  prompt = f"Ce texte est issue d'une translation vocal. L'enregistrement est tiré d'une inspection détaillé de pont et comprend du vocabulaire technique associé. Corriges les éventuelles erreurs de translation : {text}"
100
  result = postproc_pipe(prompt, max_new_tokens=256)[0]["generated_text"]
101
  return result.strip()
102
+
103
 
104
  # 🔹 Préparer WER metric
105
  wer_metric = evaluate.load("wer")
 
127
 
128
  # === Post-processing conditionnel ===
129
  if "Post-processing" in model_option:
130
+ st.write("⏳ Post-processing avec Mistral...")
131
  postprocessed_prediction = postprocess_with_llm(prediction)
132
+ st.write("✅ Post-processing terminé.")
133
  final_prediction = postprocessed_prediction
134
  else:
135
  postprocessed_prediction = "-"