Spaces:
Runtime error
Runtime error
Commit ·
56a0241
1
Parent(s): 107dc4b
fixed ocr
Browse files- app/__pycache__/main.cpython-310.pyc +0 -0
- app/main.py +5 -4
- send_image.py +4 -3
app/__pycache__/main.cpython-310.pyc
ADDED
|
Binary file (5.82 kB). View file
|
|
|
app/main.py
CHANGED
|
@@ -100,10 +100,10 @@ async def perform_ocr(
|
|
| 100 |
serialized_result = [
|
| 101 |
{
|
| 102 |
"bbox": record.bbox,
|
| 103 |
-
"confidence": record.confidence,
|
| 104 |
"text": record.prediction,
|
| 105 |
"cuts": record.cuts,
|
| 106 |
-
"line_id": record.line_id,
|
| 107 |
}
|
| 108 |
for record in result
|
| 109 |
]
|
|
@@ -179,13 +179,14 @@ async def process_all(
|
|
| 179 |
raise HTTPException(status_code=400, detail=f"Model '{model_name}' not found or invalid")
|
| 180 |
|
| 181 |
result = list(rpred.rpred(model, bw_img, segmentation))
|
|
|
|
| 182 |
serialized_result = [
|
| 183 |
{
|
| 184 |
"bbox": record.bbox,
|
| 185 |
-
"confidence": record.confidence,
|
| 186 |
"text": record.prediction,
|
| 187 |
"cuts": record.cuts,
|
| 188 |
-
"line_id": record.line_id,
|
| 189 |
}
|
| 190 |
for record in result
|
| 191 |
]
|
|
|
|
| 100 |
serialized_result = [
|
| 101 |
{
|
| 102 |
"bbox": record.bbox,
|
| 103 |
+
# "confidence": record.confidence,
|
| 104 |
"text": record.prediction,
|
| 105 |
"cuts": record.cuts,
|
| 106 |
+
# "line_id": record.line_id,
|
| 107 |
}
|
| 108 |
for record in result
|
| 109 |
]
|
|
|
|
| 179 |
raise HTTPException(status_code=400, detail=f"Model '{model_name}' not found or invalid")
|
| 180 |
|
| 181 |
result = list(rpred.rpred(model, bw_img, segmentation))
|
| 182 |
+
print(result)
|
| 183 |
serialized_result = [
|
| 184 |
{
|
| 185 |
"bbox": record.bbox,
|
| 186 |
+
# "confidence": record.confidence,
|
| 187 |
"text": record.prediction,
|
| 188 |
"cuts": record.cuts,
|
| 189 |
+
# "line_id": record.line_id,
|
| 190 |
}
|
| 191 |
for record in result
|
| 192 |
]
|
send_image.py
CHANGED
|
@@ -2,7 +2,8 @@ import requests
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
# API endpoint
|
| 5 |
-
url = "https://wjbmattingly-kraken-api.hf.space/ocr"
|
|
|
|
| 6 |
|
| 7 |
# Path to the image file
|
| 8 |
image_path = os.path.join("data", "ms.jpg")
|
|
@@ -26,9 +27,9 @@ if response.status_code == 200:
|
|
| 26 |
|
| 27 |
for record in ocr_results:
|
| 28 |
print(f"Text: {record['text']}")
|
| 29 |
-
print(f"Confidence: {record['confidence']}")
|
| 30 |
print(f"Bounding Box: {record['bbox']}")
|
| 31 |
-
print()
|
| 32 |
|
| 33 |
else:
|
| 34 |
print(f"Error: {response.status_code}")
|
|
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
# API endpoint
|
| 5 |
+
# url = "https://wjbmattingly-kraken-api.hf.space/ocr"
|
| 6 |
+
url = "http://127.0.0.1:8000/process_all"
|
| 7 |
|
| 8 |
# Path to the image file
|
| 9 |
image_path = os.path.join("data", "ms.jpg")
|
|
|
|
| 27 |
|
| 28 |
for record in ocr_results:
|
| 29 |
print(f"Text: {record['text']}")
|
| 30 |
+
# print(f"Confidence: {record['confidence']}")
|
| 31 |
print(f"Bounding Box: {record['bbox']}")
|
| 32 |
+
# print()
|
| 33 |
|
| 34 |
else:
|
| 35 |
print(f"Error: {response.status_code}")
|