Spaces:
Running
Running
Commit
Β·
07f1abd
1
Parent(s):
fa7eb7f
Add legacy survey link functionality and UI enhancements
Browse files- src/callbacks.py +13 -0
- src/components.py +19 -1
src/callbacks.py
CHANGED
|
@@ -418,6 +418,19 @@ def register_callbacks(app, search_service: SearchService):
|
|
| 418 |
|
| 419 |
return False, "", "", "", None, ""
|
| 420 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 421 |
@app.callback(
|
| 422 |
[Output("galaxy-modal", "is_open", allow_duplicate=True),
|
| 423 |
Output("modal-title", "children", allow_duplicate=True),
|
|
|
|
| 418 |
|
| 419 |
return False, "", "", "", None, ""
|
| 420 |
|
| 421 |
+
@app.callback(
|
| 422 |
+
Output("legacy-survey-link", "href"),
|
| 423 |
+
[Input("current-galaxy-data", "data")],
|
| 424 |
+
prevent_initial_call=True
|
| 425 |
+
)
|
| 426 |
+
def update_legacy_survey_link(galaxy_data):
|
| 427 |
+
"""Update Legacy Survey link with galaxy coordinates."""
|
| 428 |
+
if galaxy_data and "ra" in galaxy_data and "dec" in galaxy_data:
|
| 429 |
+
ra = galaxy_data["ra"]
|
| 430 |
+
dec = galaxy_data["dec"]
|
| 431 |
+
return f"https://www.legacysurvey.org/viewer?ra={ra}&dec={dec}&layer=ls-dr10&zoom=16"
|
| 432 |
+
return "#"
|
| 433 |
+
|
| 434 |
@app.callback(
|
| 435 |
[Output("galaxy-modal", "is_open", allow_duplicate=True),
|
| 436 |
Output("modal-title", "children", allow_duplicate=True),
|
src/components.py
CHANGED
|
@@ -176,10 +176,15 @@ def get_app_theme() -> str:
|
|
| 176 |
|
| 177 |
.btn-primary:hover {
|
| 178 |
background: rgba(255, 255, 255, 0.95);
|
|
|
|
| 179 |
transform: translateY(-1px);
|
| 180 |
box-shadow: 0 8px 24px rgba(255, 255, 255, 0.15);
|
| 181 |
}
|
| 182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
.results-header {
|
| 184 |
color: rgba(245, 245, 247, 0.6);
|
| 185 |
font-weight: 300;
|
|
@@ -840,6 +845,17 @@ def create_galaxy_modal():
|
|
| 840 |
color="primary",
|
| 841 |
className="me-2"
|
| 842 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 843 |
dbc.Button(
|
| 844 |
[html.I(className="fas fa-link me-2"), "Copy link"],
|
| 845 |
id="copy-galaxy-link",
|
|
@@ -861,7 +877,9 @@ def create_info_modal():
|
|
| 861 |
html.P("This app searches ~19 million Legacy Survey galaxies with r-mag brighter than 20 magnitude. "
|
| 862 |
"These galaxy images were converted to a text-searchable space using AION-Search, which was trained on "
|
| 863 |
"~275k text descriptions of galaxy images generated by GPT-4.1-mini.",
|
| 864 |
-
style={"color": "rgba(245, 245, 247, 0.8)", "margin-bottom": "1rem", "font-size": "0.9rem"})
|
|
|
|
|
|
|
| 865 |
]),
|
| 866 |
dbc.ModalFooter(
|
| 867 |
dbc.Button("Close", id="close-info-modal", className="ms-auto")
|
|
|
|
| 176 |
|
| 177 |
.btn-primary:hover {
|
| 178 |
background: rgba(255, 255, 255, 0.95);
|
| 179 |
+
color: #000;
|
| 180 |
transform: translateY(-1px);
|
| 181 |
box-shadow: 0 8px 24px rgba(255, 255, 255, 0.15);
|
| 182 |
}
|
| 183 |
|
| 184 |
+
.btn-primary:hover i {
|
| 185 |
+
color: #000 !important;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
.results-header {
|
| 189 |
color: rgba(245, 245, 247, 0.6);
|
| 190 |
font-weight: 300;
|
|
|
|
| 845 |
color="primary",
|
| 846 |
className="me-2"
|
| 847 |
),
|
| 848 |
+
html.A(
|
| 849 |
+
dbc.Button(
|
| 850 |
+
[html.I(className="fas fa-telescope me-2"), "View in Legacy Survey"],
|
| 851 |
+
color="primary",
|
| 852 |
+
className="me-2"
|
| 853 |
+
),
|
| 854 |
+
id="legacy-survey-link",
|
| 855 |
+
href="#",
|
| 856 |
+
target="_blank",
|
| 857 |
+
rel="noopener noreferrer"
|
| 858 |
+
),
|
| 859 |
dbc.Button(
|
| 860 |
[html.I(className="fas fa-link me-2"), "Copy link"],
|
| 861 |
id="copy-galaxy-link",
|
|
|
|
| 877 |
html.P("This app searches ~19 million Legacy Survey galaxies with r-mag brighter than 20 magnitude. "
|
| 878 |
"These galaxy images were converted to a text-searchable space using AION-Search, which was trained on "
|
| 879 |
"~275k text descriptions of galaxy images generated by GPT-4.1-mini.",
|
| 880 |
+
style={"color": "rgba(245, 245, 247, 0.8)", "margin-bottom": "1rem", "font-size": "0.9rem"}),
|
| 881 |
+
html.P("Images are from DESI Legacy Surveys DR10 via the hips2fits service provided by the Strasbourg Astronomical Data Centre (CDS).",
|
| 882 |
+
style={"color": "rgba(245, 245, 247, 0.6)", "margin-bottom": "0", "font-size": "0.75rem"})
|
| 883 |
]),
|
| 884 |
dbc.ModalFooter(
|
| 885 |
dbc.Button("Close", id="close-info-modal", className="ms-auto")
|