Spaces:
Runtime error
Runtime error
Yasin Yousif
commited on
Commit
·
8a8221e
1
Parent(s):
9cf758a
first update
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ def yolo(im, size=640):
|
|
19 |
|
20 |
r= results.pred[0].numpy().T
|
21 |
#probs = results.pred[0].numpy().T[-1]
|
22 |
-
res = [(results.names[x].lower(),p) for x,p in zip(r[-1].astype(int),r[-2]
|
23 |
f_res = story_model(res)
|
24 |
#results.render() # updates results.imgs with boxes and labels
|
25 |
#return Image.fromarray(results.imgs[0])
|
|
|
19 |
|
20 |
r= results.pred[0].numpy().T
|
21 |
#probs = results.pred[0].numpy().T[-1]
|
22 |
+
res = [(results.names[x].lower(),p) for x,p in zip(r[-1].astype(int),r[-2])]
|
23 |
f_res = story_model(res)
|
24 |
#results.render() # updates results.imgs with boxes and labels
|
25 |
#return Image.fromarray(results.imgs[0])
|
story.py
CHANGED
@@ -31,6 +31,6 @@ def story_model(preds,res_len=5):
|
|
31 |
for word,prob in preds:
|
32 |
dists += np.array([prob * (word in sent) for sent in All_sentenses])
|
33 |
|
34 |
-
f_res = list(zip(dists,All_sentenses)).sort(key=lambda x:x[
|
35 |
|
36 |
-
return f_res # list of sentenses
|
|
|
31 |
for word,prob in preds:
|
32 |
dists += np.array([prob * (word in sent) for sent in All_sentenses])
|
33 |
|
34 |
+
f_res = list(zip(dists,All_sentenses)).sort(key=lambda x:x[0])[-res_len:]
|
35 |
|
36 |
+
return [f for _,f in f_res] # list of sentenses
|