Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
28 |
-
|
|
|
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):
|