Skip to content

Commit 5ad6dde

Browse files
Made final results more robust and pretty
1 parent c554cba commit 5ad6dde

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

src/main.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from MAGIST.Vision.UnsupervisedModels.img_cluster import RoughCluster
2-
import time, os
32
import numpy as np
43

54
cluster = RoughCluster("config.json")
65

7-
imgs = cluster.unsupervised_clusters(3, "Input.jpg", (200, 200), "Clusters")
6+
imgs = cluster.unsupervised_clusters(3, "2.jpg", (200, 200), "Clusters")
87

98

109
from MAGIST.Utils.WebScraper.google import GoogleScraper
@@ -26,8 +25,6 @@
2625

2726
priority = 1
2827

29-
def dummy(a, b, c):
30-
time.sleep(30)
3128

3229
for l in labels:
3330
queue.put_queue(scraper.download_raw_img_dataset, l, 10, "Data/", name=f"Downloading {l}", priority=priority)
@@ -73,6 +70,7 @@ def dummy(a, b, c):
7370
description = wiki.get_summary(l)
7471
neural_db.insert_obj_desc(l, description)
7572

73+
neural_db.remove_duplicates()
7674

7775
from MAGIST.NLP.AudioTranscriber import GoogleAudioTranscriber
7876

@@ -91,12 +89,31 @@ def dummy(a, b, c):
9189

9290

9391
search_res = []
92+
unused_terms = []
9493
for i in selected:
95-
res = neural_db.search_obj_details(i)
94+
res = neural_db.search_entire_db(i)
9695
if res != []:
9796
search_res.append(res)
97+
else:
98+
unused_terms.append(i)
9899

99100
search_res = np.array(search_res)
100101
search_res = np.squeeze(search_res)
101102

102-
print(search_res[0]["obj_desc"])
103+
try:
104+
print("=====================================================================================================")
105+
print(search_res)
106+
print("=====================================================================================================")
107+
print(unused_terms)
108+
except IndexError:
109+
print("No results found")
110+
111+
from MAGIST.NLP.WordScraper import FullDictionarySearch
112+
113+
dict = FullDictionarySearch("config.json")
114+
115+
for i in unused_terms:
116+
definition = dict.define(i)
117+
neural_db.insert_word_desc(i, definition)
118+
119+
neural_db.remove_duplicates()

0 commit comments

Comments
 (0)