test with menu
Browse files
app.py
CHANGED
@@ -26,6 +26,60 @@ from rdkit import DataStructs
|
|
26 |
from PIL import Image
|
27 |
import matplotlib.pyplot as plt
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
colors = ["magenta", "green", "blue", "red", "orange", "magenta", "peru", "azure", "slateblue", "plum","magenta", "green", "blue", "red", "orange", "magenta", "peru", "azure", "slateblue", "plum"]
|
30 |
def plot_bbox(bbox_XYXY, label):
|
31 |
xmin, ymin, xmax, ymax =bbox_XYXY
|
|
|
26 |
from PIL import Image
|
27 |
import matplotlib.pyplot as plt
|
28 |
|
29 |
+
|
30 |
+
|
31 |
+
#### TRYOUT MENU #####
|
32 |
+
|
33 |
+
page_names_to_funcs = {
|
34 |
+
"Microscopy images from a molecule": images_from_molecule,
|
35 |
+
"Molecules from a microscopy image": molecules_from_image,
|
36 |
+
"About CLOOME": main_page,
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
selected_page = st.sidebar.selectbox("What would you like to retrieve?", page_names_to_funcs.keys())
|
41 |
+
st.sidebar.markdown('')
|
42 |
+
n_objects = st.sidebar.selectbox(
|
43 |
+
"How many objects would you like to retrieve?",
|
44 |
+
("5", "10", "20"))
|
45 |
+
|
46 |
+
|
47 |
+
selected_model = st.sidebar.selectbox(
|
48 |
+
"Select a CLOOME model to load",
|
49 |
+
("CLOOME (default)", "CLOOME (CLIP imgres 320)", "CLOOME (fullres)", "CLOOME (imgres 320)"))
|
50 |
+
|
51 |
+
model_dict = {
|
52 |
+
"CLOOME (default)" : "cloome_default.pt",
|
53 |
+
"CLOOME (CLIP imgres 320)" : "cloome_cli_imres320.pt",
|
54 |
+
"CLOOME (fullres)" : "cloome_fullres.pt",
|
55 |
+
"CLOOME (imgres 320)" : "cloome_imres320.pt"
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
model_file = model_dict[selected_model]
|
60 |
+
model_path = os.path.join(datapath, model_file)
|
61 |
+
|
62 |
+
if model_path.endswith("320).pt"):
|
63 |
+
image_resolution = 320
|
64 |
+
else:
|
65 |
+
image_resolution = 520
|
66 |
+
|
67 |
+
|
68 |
+
#page_names_to_funcs[selected_page](n_objects, model_path)
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
######################
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
colors = ["magenta", "green", "blue", "red", "orange", "magenta", "peru", "azure", "slateblue", "plum","magenta", "green", "blue", "red", "orange", "magenta", "peru", "azure", "slateblue", "plum"]
|
84 |
def plot_bbox(bbox_XYXY, label):
|
85 |
xmin, ymin, xmax, ymax =bbox_XYXY
|