dimasdeffieux commited on
Commit
f979edc
·
verified ·
1 Parent(s): ec8f38d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -24,8 +24,9 @@ def text_inference(text, language):
24
  output_ids = model.generate(input_ids, max_new_tokens=256)
25
  output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
26
 
27
- # Parse comma-separated string into list
28
- words = [word.strip() for word in output_text.split(",") if word.strip()]
 
29
  return words
30
 
31
  def ocr_inference(img, lang):
 
24
  output_ids = model.generate(input_ids, max_new_tokens=256)
25
  output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
26
 
27
+ # Parse response: take last line, split by commas
28
+ last_line = output_text.strip().split("\n")[-1]
29
+ words = [w.strip() for w in last_line.split(",") if w.strip()]
30
  return words
31
 
32
  def ocr_inference(img, lang):