Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ from pathlib import Path
|
|
| 8 |
from contextlib import redirect_stdout
|
| 9 |
import re
|
| 10 |
from huggingface_hub import snapshot_download
|
|
|
|
| 11 |
|
| 12 |
images = Path(mkdtemp())
|
| 13 |
|
|
@@ -96,7 +97,7 @@ def predict(model_name, input_img):
|
|
| 96 |
predictions = Path(pred_stdout.name).read_text().strip().splitlines()
|
| 97 |
assert len(predictions) == 1
|
| 98 |
_, score, text = LINE_PREDICTION.match(predictions[0]).groups()
|
| 99 |
-
return input_img, {"text": text, "score": score}
|
| 100 |
|
| 101 |
|
| 102 |
gradio_app = gr.Interface(
|
|
|
|
| 8 |
from contextlib import redirect_stdout
|
| 9 |
import re
|
| 10 |
from huggingface_hub import snapshot_download
|
| 11 |
+
from bidi.algorithm import get_display
|
| 12 |
|
| 13 |
images = Path(mkdtemp())
|
| 14 |
|
|
|
|
| 97 |
predictions = Path(pred_stdout.name).read_text().strip().splitlines()
|
| 98 |
assert len(predictions) == 1
|
| 99 |
_, score, text = LINE_PREDICTION.match(predictions[0]).groups()
|
| 100 |
+
return input_img, {"text": get_display(u'%s' % text, base_dir='R'), "score": score}
|
| 101 |
|
| 102 |
|
| 103 |
gradio_app = gr.Interface(
|