Spaces:
Sleeping
Sleeping
Update Gradio_UI.py
Browse files- Gradio_UI.py +37 -2
Gradio_UI.py
CHANGED
|
@@ -6,7 +6,42 @@ class GradioUI:
|
|
| 6 |
self.interface = self._create_interface()
|
| 7 |
|
| 8 |
def _create_interface(self):
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
gr.Markdown("# Landsat Image Fetcher")
|
| 11 |
gr.Markdown("Enter coordinates and a time range to fetch Landsat images from USGS.")
|
| 12 |
with gr.Row():
|
|
@@ -19,7 +54,7 @@ class GradioUI:
|
|
| 19 |
end_date = gr.Textbox(label="End Date (YYYY-MM-DD)", value="2023-12-31")
|
| 20 |
submit_btn = gr.Button("Fetch Images")
|
| 21 |
with gr.Column():
|
| 22 |
-
output = gr.HTML(label="Download Links")
|
| 23 |
submit_btn.click(
|
| 24 |
fn=lambda lm, ln, lx, lo, sd, ed: self.agent.run(
|
| 25 |
f"fetch_landsat_image({lm}, {ln}, {lx}, {lo}, '{sd}', '{ed}')"
|
|
|
|
| 6 |
self.interface = self._create_interface()
|
| 7 |
|
| 8 |
def _create_interface(self):
|
| 9 |
+
# Define custom CSS to hide the resize arrows and style the output
|
| 10 |
+
custom_css = """
|
| 11 |
+
/* Hide the resize arrows */
|
| 12 |
+
.output-container .svelte-1g9btlg { display: none !important; }
|
| 13 |
+
|
| 14 |
+
/* Style the output panel */
|
| 15 |
+
#output-panel {
|
| 16 |
+
height: 400px !important; /* Fixed height */
|
| 17 |
+
overflow-y: auto; /* Add scrollbar if content overflows */
|
| 18 |
+
border: 1px solid #ccc; /* Add a subtle border */
|
| 19 |
+
border-radius: 5px; /* Rounded corners */
|
| 20 |
+
padding: 10px; /* Inner padding */
|
| 21 |
+
background-color: #f9f9f9; /* Light background */
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/* Style the links */
|
| 25 |
+
#output-panel a {
|
| 26 |
+
color: #1a73e8; /* Google-blue link color */
|
| 27 |
+
text-decoration: none; /* Remove underline */
|
| 28 |
+
font-weight: bold; /* Bold links */
|
| 29 |
+
}
|
| 30 |
+
#output-panel a:hover {
|
| 31 |
+
text-decoration: underline; /* Underline on hover */
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/* Style the list items */
|
| 35 |
+
#output-panel ul {
|
| 36 |
+
list-style-type: none; /* Remove default bullets */
|
| 37 |
+
padding-left: 0; /* Remove default padding */
|
| 38 |
+
}
|
| 39 |
+
#output-panel li {
|
| 40 |
+
margin-bottom: 10px; /* Space between list items */
|
| 41 |
+
}
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
with gr.Blocks(title="Landsat Image Fetcher", css=custom_css) as demo:
|
| 45 |
gr.Markdown("# Landsat Image Fetcher")
|
| 46 |
gr.Markdown("Enter coordinates and a time range to fetch Landsat images from USGS.")
|
| 47 |
with gr.Row():
|
|
|
|
| 54 |
end_date = gr.Textbox(label="End Date (YYYY-MM-DD)", value="2023-12-31")
|
| 55 |
submit_btn = gr.Button("Fetch Images")
|
| 56 |
with gr.Column():
|
| 57 |
+
output = gr.HTML(label="Download Links", elem_id="output-panel")
|
| 58 |
submit_btn.click(
|
| 59 |
fn=lambda lm, ln, lx, lo, sd, ed: self.agent.run(
|
| 60 |
f"fetch_landsat_image({lm}, {ln}, {lx}, {lo}, '{sd}', '{ed}')"
|