Spaces:
Sleeping
Sleeping
Get functional URL in more info return
Browse files- app.py +4 -4
- components/query.py +3 -2
app.py
CHANGED
@@ -237,9 +237,9 @@ if __name__ == "__main__":
|
|
237 |
# open_domain_flag_btn = gr.Button("Flag Mistake", variant="primary")
|
238 |
|
239 |
with gr.Row():
|
240 |
-
taxon_url = gr.
|
241 |
-
elem_id = "
|
242 |
-
|
243 |
|
244 |
with gr.Row():
|
245 |
gr.Examples(
|
@@ -340,4 +340,4 @@ if __name__ == "__main__":
|
|
340 |
)
|
341 |
|
342 |
app.queue(max_size=20)
|
343 |
-
app.launch()
|
|
|
237 |
# open_domain_flag_btn = gr.Button("Flag Mistake", variant="primary")
|
238 |
|
239 |
with gr.Row():
|
240 |
+
taxon_url = gr.HTML(label = "More Information",
|
241 |
+
elem_id = "url"
|
242 |
+
)
|
243 |
|
244 |
with gr.Row():
|
245 |
gr.Examples(
|
|
|
340 |
)
|
341 |
|
342 |
app.queue(max_size=20)
|
343 |
+
app.launch(share=True)
|
components/query.py
CHANGED
@@ -57,10 +57,11 @@ def get_sample(df, pred_taxon, rank):
|
|
57 |
)
|
58 |
img_resp = requests.get(img_src)
|
59 |
img = Image.open(io.BytesIO(img_resp.content))
|
|
|
60 |
if is_exact:
|
61 |
-
eol_page = f"Check out the EOL entry for {pred_taxon} to learn more: {
|
62 |
else:
|
63 |
-
eol_page = f"Check out an example EOL entry within {pred_taxon} to learn more: {full_name} {
|
64 |
logger.info(f"Successfully retrieved sample image and EOL page for {pred_taxon}")
|
65 |
return img, eol_page
|
66 |
except Exception as e:
|
|
|
57 |
)
|
58 |
img_resp = requests.get(img_src)
|
59 |
img = Image.open(io.BytesIO(img_resp.content))
|
60 |
+
full_eol_url = EOL_URL + eol_page_id
|
61 |
if is_exact:
|
62 |
+
eol_page = f"<p>Check out the EOL entry for {pred_taxon} to learn more: <a href={full_eol_url} target='_blank'>{full_eol_url}</a>.</p>"
|
63 |
else:
|
64 |
+
eol_page = f"<p>Check out an example EOL entry within {pred_taxon} to learn more: {full_name} <a href={full_eol_url} target='_blank'>{full_eol_url}</a>.</p>"
|
65 |
logger.info(f"Successfully retrieved sample image and EOL page for {pred_taxon}")
|
66 |
return img, eol_page
|
67 |
except Exception as e:
|