Spaces:
Runtime error
Runtime error
alitavanaali
commited on
Commit
·
a518fb8
1
Parent(s):
6897d4f
Update app.py
Browse files
app.py
CHANGED
@@ -276,34 +276,11 @@ def mergeCloseBoxes(pr, bb, wr, threshold):
|
|
276 |
|
277 |
return final_bbox, final_preds, final_words
|
278 |
|
279 |
-
def createDataframe(
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
#print(words)
|
285 |
-
#print('@@@@@')
|
286 |
-
#print(flag_label)
|
287 |
-
row_number = -1
|
288 |
-
for i in range(len(preds)):
|
289 |
-
#print('i is: {}'.format(i))
|
290 |
-
if (preds[i] == flag_label):
|
291 |
-
row_number = row_number + 1
|
292 |
-
df.at[row_number, preds[i]] = words[i]
|
293 |
-
#print('row number is: {}'.format(row_number))
|
294 |
-
continue
|
295 |
-
|
296 |
-
else:
|
297 |
-
#print('row_number {} is <= of df.shape {}'.format(row_number, df.shape[0]))
|
298 |
-
#print(pd.isna(df[preds[i]].iloc[row_number]))
|
299 |
-
#print(pd.isna(df[preds[i]].iloc[row_number]))
|
300 |
-
if(pd.isna(df[preds[i]].iloc[row_number])):
|
301 |
-
df.at[row_number, preds[i]] = words[i]
|
302 |
-
else:
|
303 |
-
row_number = row_number + 1
|
304 |
-
df.at[row_number, preds[i]] = words[i]
|
305 |
-
|
306 |
-
return df
|
307 |
|
308 |
def isInside(w, z):
|
309 |
# return True if w is inside z, if z is inside w return false
|
|
|
276 |
|
277 |
return final_bbox, final_preds, final_words
|
278 |
|
279 |
+
def createDataframe(predictions, words):
|
280 |
+
result1, result2 = zip(*sorted(zip(predictions, words), key=lambda x: x[0]))
|
281 |
+
d = {'key':result1,'value':result2}
|
282 |
+
df = pd.DataFrame(d)
|
283 |
+
return df
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
|
285 |
def isInside(w, z):
|
286 |
# return True if w is inside z, if z is inside w return false
|