Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,20 +14,18 @@ st.set_page_config(
|
|
| 14 |
# -----------------------
|
| 15 |
# Sidebar content
|
| 16 |
# -----------------------
|
| 17 |
-
st.sidebar.title("Paddle OCR Demo")
|
| 18 |
st.sidebar.markdown(
|
| 19 |
"""
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
"""
|
| 31 |
)
|
| 32 |
|
| 33 |
# -----------------------
|
|
@@ -36,15 +34,14 @@ st.sidebar.markdown(
|
|
| 36 |
st.title("Paddle OCR Text Detection and Recognition")
|
| 37 |
st.write(
|
| 38 |
"Upload an image containing text and click **Run OCR** to detect text regions "
|
| 39 |
-
"and recognize the text using PaddleOCR models
|
| 40 |
)
|
| 41 |
|
| 42 |
# -----------------------
|
| 43 |
# Hardcoded configuration
|
| 44 |
# -----------------------
|
| 45 |
-
INFERENCE_HOST_ADDRESS = "@
|
| 46 |
-
ZOO_URL = "degirum/
|
| 47 |
-
DEVICE_TYPE = ["HAILORT/HAILO8"] # must be a list
|
| 48 |
|
| 49 |
PADDLE_OCR_DET_MODEL_NAME = "paddle_ocr_detection--544x960_quant_hailort_hailo8_1"
|
| 50 |
PADDLE_OCR_REC_MODEL_NAME = "paddle_ocr_recognition--48x320_quant_hailort_hailo8_1"
|
|
@@ -64,7 +61,6 @@ def load_crop_model():
|
|
| 64 |
model_name=PADDLE_OCR_DET_MODEL_NAME,
|
| 65 |
inference_host_address=INFERENCE_HOST_ADDRESS,
|
| 66 |
zoo_url=ZOO_URL,
|
| 67 |
-
device_type=DEVICE_TYPE,
|
| 68 |
token=token,
|
| 69 |
image_backend="pil",
|
| 70 |
)
|
|
@@ -74,7 +70,6 @@ def load_crop_model():
|
|
| 74 |
model_name=PADDLE_OCR_REC_MODEL_NAME,
|
| 75 |
inference_host_address=INFERENCE_HOST_ADDRESS,
|
| 76 |
zoo_url=ZOO_URL,
|
| 77 |
-
device_type=DEVICE_TYPE,
|
| 78 |
token=token,
|
| 79 |
image_backend="pil",
|
| 80 |
)
|
|
|
|
| 14 |
# -----------------------
|
| 15 |
# Sidebar content
|
| 16 |
# -----------------------
|
|
|
|
| 17 |
st.sidebar.markdown(
|
| 18 |
"""
|
| 19 |
+
About this demo
|
| 20 |
+
Inference location: DeGirum Cloud
|
| 21 |
+
Models used:
|
| 22 |
+
Text detection: paddle_ocr_detection--544x960_quant_hailort_hailo8_1
|
| 23 |
+
Text recognition: paddle_ocr_recognition--48x320_quant_hailort_hailo8_1
|
| 24 |
+
Libraries:
|
| 25 |
+
degirum
|
| 26 |
+
degirum_tools
|
| 27 |
+
streamlit
|
| 28 |
+
"""
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
# -----------------------
|
|
|
|
| 34 |
st.title("Paddle OCR Text Detection and Recognition")
|
| 35 |
st.write(
|
| 36 |
"Upload an image containing text and click **Run OCR** to detect text regions "
|
| 37 |
+
"and recognize the text using PaddleOCR models."
|
| 38 |
)
|
| 39 |
|
| 40 |
# -----------------------
|
| 41 |
# Hardcoded configuration
|
| 42 |
# -----------------------
|
| 43 |
+
INFERENCE_HOST_ADDRESS = "@cloud" # DeGirum Cloud
|
| 44 |
+
ZOO_URL = "https://cs.degirum.com/degirum/degirum"
|
|
|
|
| 45 |
|
| 46 |
PADDLE_OCR_DET_MODEL_NAME = "paddle_ocr_detection--544x960_quant_hailort_hailo8_1"
|
| 47 |
PADDLE_OCR_REC_MODEL_NAME = "paddle_ocr_recognition--48x320_quant_hailort_hailo8_1"
|
|
|
|
| 61 |
model_name=PADDLE_OCR_DET_MODEL_NAME,
|
| 62 |
inference_host_address=INFERENCE_HOST_ADDRESS,
|
| 63 |
zoo_url=ZOO_URL,
|
|
|
|
| 64 |
token=token,
|
| 65 |
image_backend="pil",
|
| 66 |
)
|
|
|
|
| 70 |
model_name=PADDLE_OCR_REC_MODEL_NAME,
|
| 71 |
inference_host_address=INFERENCE_HOST_ADDRESS,
|
| 72 |
zoo_url=ZOO_URL,
|
|
|
|
| 73 |
token=token,
|
| 74 |
image_backend="pil",
|
| 75 |
)
|