Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -156,8 +156,6 @@ class OceanCurrentMapper:
|
|
| 156 |
title=f'Ocean Currents - {region}',
|
| 157 |
xaxis=dict(
|
| 158 |
title='Longitude',
|
| 159 |
-
scaleanchor="y",
|
| 160 |
-
scaleratio=1,
|
| 161 |
constrain="domain"
|
| 162 |
),
|
| 163 |
yaxis=dict(
|
|
@@ -166,9 +164,7 @@ class OceanCurrentMapper:
|
|
| 166 |
),
|
| 167 |
showlegend=True,
|
| 168 |
autosize=True,
|
| 169 |
-
#
|
| 170 |
-
width=800,
|
| 171 |
-
height=600,
|
| 172 |
margin=dict(l=60, r=100, t=80, b=60),
|
| 173 |
# Add responsive config
|
| 174 |
dragmode='pan',
|
|
@@ -252,8 +248,6 @@ class OceanCurrentMapper:
|
|
| 252 |
fig.update_layout(
|
| 253 |
title=f'Ocean Conditions Forecast - {region}',
|
| 254 |
showlegend=False,
|
| 255 |
-
width=800,
|
| 256 |
-
height=650,
|
| 257 |
autosize=True,
|
| 258 |
margin=dict(l=60, r=50, t=80, b=60),
|
| 259 |
hovermode='x unified'
|
|
@@ -316,7 +310,7 @@ def create_current_map(region, resolution, show_vectors, show_speed, vector_scal
|
|
| 316 |
# Return empty plot on error
|
| 317 |
fig = go.Figure()
|
| 318 |
fig.add_annotation(text=f"Error: {str(e)}", x=0.5, y=0.5, showarrow=False)
|
| 319 |
-
fig.update_layout(
|
| 320 |
return fig
|
| 321 |
|
| 322 |
def create_forecast(region, forecast_hours):
|
|
@@ -328,7 +322,7 @@ def create_forecast(region, forecast_hours):
|
|
| 328 |
# Return empty plot on error
|
| 329 |
fig = go.Figure()
|
| 330 |
fig.add_annotation(text=f"Error: {str(e)}", x=0.5, y=0.5, showarrow=False)
|
| 331 |
-
fig.update_layout(
|
| 332 |
return fig
|
| 333 |
|
| 334 |
def analyze_conditions(region):
|
|
@@ -359,7 +353,7 @@ with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
|
|
| 359 |
|
| 360 |
with gr.Tab("Current Map"):
|
| 361 |
with gr.Row():
|
| 362 |
-
with gr.Column(scale=1
|
| 363 |
region = gr.Dropdown(
|
| 364 |
choices=["Gulf of Mexico", "California Coast", "Atlantic Coast", "Global"],
|
| 365 |
value="Gulf of Mexico",
|
|
@@ -381,12 +375,10 @@ with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
|
|
| 381 |
)
|
| 382 |
update_map = gr.Button("Update Map", variant="primary")
|
| 383 |
|
| 384 |
-
with gr.Column(scale=2
|
| 385 |
current_map = gr.Plot(
|
| 386 |
label="Ocean Current Map",
|
| 387 |
-
show_label=False
|
| 388 |
-
container=True,
|
| 389 |
-
scale=1
|
| 390 |
)
|
| 391 |
|
| 392 |
update_map.click(
|
|
@@ -397,7 +389,7 @@ with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
|
|
| 397 |
|
| 398 |
with gr.Tab("Forecast"):
|
| 399 |
with gr.Row():
|
| 400 |
-
with gr.Column(scale=1
|
| 401 |
forecast_region = gr.Dropdown(
|
| 402 |
choices=["Gulf of Mexico", "California Coast", "Atlantic Coast", "Global"],
|
| 403 |
value="Gulf of Mexico",
|
|
@@ -412,12 +404,10 @@ with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
|
|
| 412 |
)
|
| 413 |
update_forecast = gr.Button("Generate Forecast", variant="primary")
|
| 414 |
|
| 415 |
-
with gr.Column(scale=2
|
| 416 |
forecast_plot = gr.Plot(
|
| 417 |
label="Ocean Conditions Forecast",
|
| 418 |
-
show_label=False
|
| 419 |
-
container=True,
|
| 420 |
-
scale=1
|
| 421 |
)
|
| 422 |
|
| 423 |
update_forecast.click(
|
|
@@ -428,7 +418,7 @@ with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
|
|
| 428 |
|
| 429 |
with gr.Tab("Surfing Conditions"):
|
| 430 |
with gr.Row():
|
| 431 |
-
with gr.Column(scale=1
|
| 432 |
surf_region = gr.Dropdown(
|
| 433 |
choices=["Gulf of Mexico", "California Coast", "Atlantic Coast"],
|
| 434 |
value="California Coast",
|
|
@@ -436,7 +426,7 @@ with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
|
|
| 436 |
)
|
| 437 |
analyze_button = gr.Button("Analyze Conditions", variant="primary")
|
| 438 |
|
| 439 |
-
with gr.Column(scale=2
|
| 440 |
surf_analysis = gr.Textbox(
|
| 441 |
label="Surfing Conditions Analysis",
|
| 442 |
lines=8,
|
|
|
|
| 156 |
title=f'Ocean Currents - {region}',
|
| 157 |
xaxis=dict(
|
| 158 |
title='Longitude',
|
|
|
|
|
|
|
| 159 |
constrain="domain"
|
| 160 |
),
|
| 161 |
yaxis=dict(
|
|
|
|
| 164 |
),
|
| 165 |
showlegend=True,
|
| 166 |
autosize=True,
|
| 167 |
+
# Remove fixed dimensions - let it be responsive
|
|
|
|
|
|
|
| 168 |
margin=dict(l=60, r=100, t=80, b=60),
|
| 169 |
# Add responsive config
|
| 170 |
dragmode='pan',
|
|
|
|
| 248 |
fig.update_layout(
|
| 249 |
title=f'Ocean Conditions Forecast - {region}',
|
| 250 |
showlegend=False,
|
|
|
|
|
|
|
| 251 |
autosize=True,
|
| 252 |
margin=dict(l=60, r=50, t=80, b=60),
|
| 253 |
hovermode='x unified'
|
|
|
|
| 310 |
# Return empty plot on error
|
| 311 |
fig = go.Figure()
|
| 312 |
fig.add_annotation(text=f"Error: {str(e)}", x=0.5, y=0.5, showarrow=False)
|
| 313 |
+
fig.update_layout(autosize=True)
|
| 314 |
return fig
|
| 315 |
|
| 316 |
def create_forecast(region, forecast_hours):
|
|
|
|
| 322 |
# Return empty plot on error
|
| 323 |
fig = go.Figure()
|
| 324 |
fig.add_annotation(text=f"Error: {str(e)}", x=0.5, y=0.5, showarrow=False)
|
| 325 |
+
fig.update_layout(autosize=True)
|
| 326 |
return fig
|
| 327 |
|
| 328 |
def analyze_conditions(region):
|
|
|
|
| 353 |
|
| 354 |
with gr.Tab("Current Map"):
|
| 355 |
with gr.Row():
|
| 356 |
+
with gr.Column(scale=1):
|
| 357 |
region = gr.Dropdown(
|
| 358 |
choices=["Gulf of Mexico", "California Coast", "Atlantic Coast", "Global"],
|
| 359 |
value="Gulf of Mexico",
|
|
|
|
| 375 |
)
|
| 376 |
update_map = gr.Button("Update Map", variant="primary")
|
| 377 |
|
| 378 |
+
with gr.Column(scale=2):
|
| 379 |
current_map = gr.Plot(
|
| 380 |
label="Ocean Current Map",
|
| 381 |
+
show_label=False
|
|
|
|
|
|
|
| 382 |
)
|
| 383 |
|
| 384 |
update_map.click(
|
|
|
|
| 389 |
|
| 390 |
with gr.Tab("Forecast"):
|
| 391 |
with gr.Row():
|
| 392 |
+
with gr.Column(scale=1):
|
| 393 |
forecast_region = gr.Dropdown(
|
| 394 |
choices=["Gulf of Mexico", "California Coast", "Atlantic Coast", "Global"],
|
| 395 |
value="Gulf of Mexico",
|
|
|
|
| 404 |
)
|
| 405 |
update_forecast = gr.Button("Generate Forecast", variant="primary")
|
| 406 |
|
| 407 |
+
with gr.Column(scale=2):
|
| 408 |
forecast_plot = gr.Plot(
|
| 409 |
label="Ocean Conditions Forecast",
|
| 410 |
+
show_label=False
|
|
|
|
|
|
|
| 411 |
)
|
| 412 |
|
| 413 |
update_forecast.click(
|
|
|
|
| 418 |
|
| 419 |
with gr.Tab("Surfing Conditions"):
|
| 420 |
with gr.Row():
|
| 421 |
+
with gr.Column(scale=1):
|
| 422 |
surf_region = gr.Dropdown(
|
| 423 |
choices=["Gulf of Mexico", "California Coast", "Atlantic Coast"],
|
| 424 |
value="California Coast",
|
|
|
|
| 426 |
)
|
| 427 |
analyze_button = gr.Button("Analyze Conditions", variant="primary")
|
| 428 |
|
| 429 |
+
with gr.Column(scale=2):
|
| 430 |
surf_analysis = gr.Textbox(
|
| 431 |
label="Surfing Conditions Analysis",
|
| 432 |
lines=8,
|