Update app.py
Browse files
app.py
CHANGED
@@ -62,14 +62,14 @@ def prepare_image(img):
|
|
62 |
|
63 |
return pred_texts, preds
|
64 |
|
65 |
-
# Define a simple batch decoder (adjust as needed)
|
66 |
def decode_batch_predictions(pred):
|
67 |
-
|
68 |
-
# Modify this function based on your specific character map
|
69 |
pred_texts = []
|
70 |
-
|
71 |
-
|
|
|
72 |
pred_texts.append(pred_text)
|
|
|
73 |
return pred_texts
|
74 |
|
75 |
def run():
|
|
|
62 |
|
63 |
return pred_texts, preds
|
64 |
|
|
|
65 |
def decode_batch_predictions(pred):
|
66 |
+
characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" # Update sesuai dengan karakter yang digunakan
|
|
|
67 |
pred_texts = []
|
68 |
+
|
69 |
+
for i in range(len(pred)): # Looping melalui prediksi batch
|
70 |
+
pred_text = ''.join([characters[int(c)] for c in pred[i].tolist() if c != -1]) # Convert pred[i] ke list dan menghindari -1
|
71 |
pred_texts.append(pred_text)
|
72 |
+
|
73 |
return pred_texts
|
74 |
|
75 |
def run():
|