CCockrum commited on
Commit
2b736a8
Β·
verified Β·
1 Parent(s): 5ccf762

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -13
app.py CHANGED
@@ -146,8 +146,10 @@ class OceanCurrentMapper:
146
  xaxis_title='Longitude',
147
  yaxis_title='Latitude',
148
  showlegend=True,
149
- width=800,
150
- height=600
 
 
151
  )
152
 
153
  return fig
@@ -205,8 +207,10 @@ class OceanCurrentMapper:
205
  yaxis2=dict(title='Wave Height (m)', side='right', overlaying='y'),
206
  yaxis3=dict(title='Wind Speed (m/s)', side='right', overlaying='y', position=0.95),
207
  showlegend=True,
208
- width=800,
209
- height=400
 
 
210
  )
211
 
212
  return fig
@@ -222,20 +226,20 @@ class OceanCurrentMapper:
222
  conditions = []
223
 
224
  if avg_speed < 0.3:
225
- conditions.append("Low current speeds - good for beginners")
226
  elif avg_speed < 0.8:
227
- conditions.append("Moderate currents - suitable for intermediate surfers")
228
  else:
229
- conditions.append("Strong currents - experienced surfers only")
230
 
231
  if max_speed > 1.0:
232
- conditions.append("Strong rip currents detected in some areas")
233
 
234
  # Add mock weather conditions
235
  conditions.extend([
236
- f"Water temperature: {20 + np.random.randint(0, 10)}Β°C",
237
- f"Wind: {5 + np.random.randint(0, 15)} mph offshore",
238
- f"Wave height: {1 + np.random.randint(0, 3)} meters"
239
  ])
240
 
241
  return "\n".join(conditions)
@@ -257,7 +261,7 @@ def analyze_conditions(region):
257
  with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
258
  gr.Markdown("""
259
  <h1 style="font-size: 3em; text-align: center; color: #2E86AB; margin-bottom: 0.5em;">
260
- Real-Time Ocean Current Mapping Tool
261
  </h1>
262
 
263
  <div style="text-align: center; font-size: 1.2em; margin-bottom: 2em;">
@@ -386,4 +390,9 @@ with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
386
 
387
  # Launch the app
388
  if __name__ == "__main__":
389
- demo.launch()
 
 
 
 
 
 
146
  xaxis_title='Longitude',
147
  yaxis_title='Latitude',
148
  showlegend=True,
149
+ width=None, # Let it auto-size
150
+ height=500, # Smaller height for embedding
151
+ autosize=True,
152
+ margin=dict(l=50, r=50, t=80, b=50)
153
  )
154
 
155
  return fig
 
207
  yaxis2=dict(title='Wave Height (m)', side='right', overlaying='y'),
208
  yaxis3=dict(title='Wind Speed (m/s)', side='right', overlaying='y', position=0.95),
209
  showlegend=True,
210
+ width=None, # Let it auto-size
211
+ height=350, # Smaller height for embedding
212
+ autosize=True,
213
+ margin=dict(l=50, r=50, t=80, b=50)
214
  )
215
 
216
  return fig
 
226
  conditions = []
227
 
228
  if avg_speed < 0.3:
229
+ conditions.append("βœ… Low current speeds - good for beginners")
230
  elif avg_speed < 0.8:
231
+ conditions.append("⚠️ Moderate currents - suitable for intermediate surfers")
232
  else:
233
+ conditions.append("❌ Strong currents - experienced surfers only")
234
 
235
  if max_speed > 1.0:
236
+ conditions.append("🌊 Strong rip currents detected in some areas")
237
 
238
  # Add mock weather conditions
239
  conditions.extend([
240
+ f"🌑️ Water temperature: {20 + np.random.randint(0, 10)}°C",
241
+ f"πŸ’¨ Wind: {5 + np.random.randint(0, 15)} mph offshore",
242
+ f"🌊 Wave height: {1 + np.random.randint(0, 3)} meters"
243
  ])
244
 
245
  return "\n".join(conditions)
 
261
  with gr.Blocks(title="Ocean Current Mapper", theme=gr.themes.Ocean()) as demo:
262
  gr.Markdown("""
263
  <h1 style="font-size: 3em; text-align: center; color: #2E86AB; margin-bottom: 0.5em;">
264
+ 🌊 Real-Time Ocean Current Mapper
265
  </h1>
266
 
267
  <div style="text-align: center; font-size: 1.2em; margin-bottom: 2em;">
 
390
 
391
  # Launch the app
392
  if __name__ == "__main__":
393
+ demo.launch(
394
+ share=True,
395
+ height=600, # Set overall app height
396
+ show_error=True,
397
+ inbrowser=False
398
+ )