Spaces:
Sleeping
Sleeping
kuanyu commited on
Upload 4 files
Browse files- OCR_test.cpython-310-x86_64-linux-gnu.so +0 -0
- app.py +24 -0
- best.pt +3 -0
- requirements.txt +8 -0
OCR_test.cpython-310-x86_64-linux-gnu.so
ADDED
|
Binary file (247 kB). View file
|
|
|
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from OCR_test import process_image
|
| 3 |
+
|
| 4 |
+
def detect_objects(image):
|
| 5 |
+
try:
|
| 6 |
+
# Call the `process_image` function with the image path
|
| 7 |
+
result = process_image(image)
|
| 8 |
+
return result
|
| 9 |
+
except Exception as e:
|
| 10 |
+
# Return any errors encountered during processing
|
| 11 |
+
return f"Error: {e}"
|
| 12 |
+
|
| 13 |
+
# Define the Gradio interface
|
| 14 |
+
interface = gr.Interface(
|
| 15 |
+
fn=detect_objects,
|
| 16 |
+
inputs=gr.Image(type="filepath", label="Upload Image"), # Set to "filepath" to pass file path directly
|
| 17 |
+
outputs=gr.Textbox(label="Detection Results"),
|
| 18 |
+
title="OCR Object Detection",
|
| 19 |
+
description="Upload an image to get OCR results."
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Launch the Gradio app
|
| 23 |
+
if __name__ == "__main__":
|
| 24 |
+
interface.launch()
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:995e238a347b4ec05318d30615e7d93694087ba2c087ef69cb6f233871419e64
|
| 3 |
+
size 15254210
|
requirements.txt
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
torch>=1.8.0
|
| 3 |
+
torch>=1.8.0,!=2.4.0; sys_platform == 'win32' # Windows CPU errors w/ 2.4.0 https://github.com/ultralytics/ultralytics/issues/15049
|
| 4 |
+
torchvision>=0.9.0
|
| 5 |
+
ultralytics>=8.3.0
|
| 6 |
+
Pillow
|
| 7 |
+
opencv-python-headless
|
| 8 |
+
cython
|