install libssl1.1 in app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import cv2
|
| 2 |
import gradio as gr
|
| 3 |
import numpy as np
|
|
@@ -29,7 +44,9 @@ def predict(image: Image.Image, question: str, ocr_engine: str):
|
|
| 29 |
boxes = np.asarray([x[0] for x in ocr_result]) # (n_boxes, 4, 2)
|
| 30 |
|
| 31 |
for box in boxes:
|
| 32 |
-
cv2.polylines(
|
|
|
|
|
|
|
| 33 |
|
| 34 |
x1 = boxes[:, :, 0].min(1) * 1000 / image.width
|
| 35 |
y1 = boxes[:, :, 1].min(1) * 1000 / image.height
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
|
| 3 |
+
if sys.platform == "linux":
|
| 4 |
+
try:
|
| 5 |
+
import paddle
|
| 6 |
+
|
| 7 |
+
except ImportError:
|
| 8 |
+
import subprocess
|
| 9 |
+
|
| 10 |
+
# install libssl1.1 on HF spaces
|
| 11 |
+
subprocess.run(
|
| 12 |
+
"wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb".split()
|
| 13 |
+
)
|
| 14 |
+
subprocess.run("sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb".split())
|
| 15 |
+
|
| 16 |
import cv2
|
| 17 |
import gradio as gr
|
| 18 |
import numpy as np
|
|
|
|
| 44 |
boxes = np.asarray([x[0] for x in ocr_result]) # (n_boxes, 4, 2)
|
| 45 |
|
| 46 |
for box in boxes:
|
| 47 |
+
cv2.polylines(
|
| 48 |
+
image_np, [box.reshape(-1, 1, 2).astype(int)], True, (0, 255, 255), 3
|
| 49 |
+
)
|
| 50 |
|
| 51 |
x1 = boxes[:, :, 0].min(1) * 1000 / image.width
|
| 52 |
y1 = boxes[:, :, 1].min(1) * 1000 / image.height
|