Spaces:
Sleeping
Sleeping
Improved UI
Browse files
app.py
CHANGED
@@ -57,7 +57,7 @@ def classify(image: np.array, history):
|
|
57 |
for label, count in Counter(r.tolist()).most_common()][-MAX_PREDS:]
|
58 |
ratios += [gr.Textbox(visible=False)] * (MAX_PREDS - len(ratios))
|
59 |
detail : SpeciesDetail = labels[p.item()]
|
60 |
-
pred = gr.Markdown(f"## Predictions {detail.name} \n {detail.desc} \n\n Find out more: {detail.link}")
|
61 |
|
62 |
history += [(resize_image(image), detail.name)]
|
63 |
hist = history[-MAX_HISTORY:]
|
@@ -95,7 +95,7 @@ MAX_SAMPLE_COUNT = max([len(os.listdir(x)) for x in listdir_full(SAMPLE_DIR)])
|
|
95 |
def sample_tab(image_input, tabs):
|
96 |
|
97 |
def choose_image(image):
|
98 |
-
return gr.Image(image), gr.Tabs(selected=0)
|
99 |
|
100 |
def refresh_samples(species):
|
101 |
images = listdir_full(f"{SAMPLE_DIR}/{species}")
|
@@ -119,7 +119,7 @@ def sample_tab(image_input, tabs):
|
|
119 |
|
120 |
images.append(image)
|
121 |
buttons.append(select)
|
122 |
-
select.click(choose_image, image, [image_input, tabs])
|
123 |
|
124 |
with gr.Row(): [sample_panel() for _ in range(MAX_SAMPLE_COUNT)]
|
125 |
|
|
|
57 |
for label, count in Counter(r.tolist()).most_common()][-MAX_PREDS:]
|
58 |
ratios += [gr.Textbox(visible=False)] * (MAX_PREDS - len(ratios))
|
59 |
detail : SpeciesDetail = labels[p.item()]
|
60 |
+
pred = gr.Markdown(f"## Predictions: {detail.name} \n {detail.desc} \n\n Find out more: {detail.link}")
|
61 |
|
62 |
history += [(resize_image(image), detail.name)]
|
63 |
hist = history[-MAX_HISTORY:]
|
|
|
95 |
def sample_tab(image_input, tabs):
|
96 |
|
97 |
def choose_image(image):
|
98 |
+
return gr.Image(image), gr.Image(image), gr.Tabs(selected=0)
|
99 |
|
100 |
def refresh_samples(species):
|
101 |
images = listdir_full(f"{SAMPLE_DIR}/{species}")
|
|
|
119 |
|
120 |
images.append(image)
|
121 |
buttons.append(select)
|
122 |
+
select.click(choose_image, image, [image, image_input, tabs])
|
123 |
|
124 |
with gr.Row(): [sample_panel() for _ in range(MAX_SAMPLE_COUNT)]
|
125 |
|