Spaces:
Sleeping
Sleeping
Yaz Hobooti
commited on
Commit
·
8d331e6
1
Parent(s):
c54befb
Fix indentation errors in app.py around line 1102
Browse files
app.py
CHANGED
|
@@ -1098,19 +1098,19 @@ def _decode_zxing_all(pil: Image.Image) -> List[Dict[str, Any]]:
|
|
| 1098 |
zx = zxingcpp.read_barcodes(arr)
|
| 1099 |
for r in zx or []:
|
| 1100 |
x1=y1=w=h=0
|
| 1101 |
-
|
| 1102 |
pts=[]
|
| 1103 |
-
|
| 1104 |
-
|
| 1105 |
pts=list(pos)
|
| 1106 |
-
|
| 1107 |
for name in ("top_left","topLeft","top_right","topRight","bottom_left","bottomLeft","bottom_right","bottomRight",
|
| 1108 |
"point1","point2","point3","point4"):
|
| 1109 |
-
|
| 1110 |
p=getattr(pos,name)
|
| 1111 |
if hasattr(p,"x") and hasattr(p,"y"):
|
| 1112 |
-
|
| 1113 |
-
|
| 1114 |
xs=[int(getattr(p,"x",0)) for p in pts]; ys=[int(getattr(p,"y",0)) for p in pts]
|
| 1115 |
x1, x2 = min(xs), max(xs); y1, y2 = min(ys), max(ys); w, h = x2-x1, y2-y1
|
| 1116 |
results.append({
|
|
|
|
| 1098 |
zx = zxingcpp.read_barcodes(arr)
|
| 1099 |
for r in zx or []:
|
| 1100 |
x1=y1=w=h=0
|
| 1101 |
+
pos = getattr(r, "position", None)
|
| 1102 |
pts=[]
|
| 1103 |
+
if pos is not None:
|
| 1104 |
+
try:
|
| 1105 |
pts=list(pos)
|
| 1106 |
+
except TypeError:
|
| 1107 |
for name in ("top_left","topLeft","top_right","topRight","bottom_left","bottomLeft","bottom_right","bottomRight",
|
| 1108 |
"point1","point2","point3","point4"):
|
| 1109 |
+
if hasattr(pos, name):
|
| 1110 |
p=getattr(pos,name)
|
| 1111 |
if hasattr(p,"x") and hasattr(p,"y"):
|
| 1112 |
+
pts.append(p)
|
| 1113 |
+
if pts:
|
| 1114 |
xs=[int(getattr(p,"x",0)) for p in pts]; ys=[int(getattr(p,"y",0)) for p in pts]
|
| 1115 |
x1, x2 = min(xs), max(xs); y1, y2 = min(ys), max(ys); w, h = x2-x1, y2-y1
|
| 1116 |
results.append({
|