euler314 commited on
Commit
3ec3260
ยท
verified ยท
1 Parent(s): ebaf6cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -25,6 +25,7 @@ import cartopy.crs as ccrs
25
  import cartopy.feature as cfeature
26
  import plotly.graph_objects as go
27
  import plotly.express as px
 
28
  from plotly.subplots import make_subplots
29
 
30
  from sklearn.manifold import TSNE
@@ -3004,7 +3005,7 @@ def create_interface():
3004
  """)
3005
 
3006
  with gr.Row():
3007
- genesis_animation = gr.Plot(label="๐Ÿ—บ๏ธ Daily Genesis Potential & Storm Development")
3008
 
3009
  with gr.Row():
3010
  genesis_summary = gr.Textbox(label="๐Ÿ“‹ Monthly Genesis Analysis Summary", lines=25)
@@ -3013,21 +3014,25 @@ def create_interface():
3013
  try:
3014
  # Generate monthly prediction using GPI
3015
  prediction_data = generate_genesis_prediction_monthly(month, oni, year=2025)
3016
-
3017
- # Create animation
3018
  genesis_fig = create_genesis_animation(prediction_data, animation)
3019
 
 
 
 
3020
  # Generate summary
3021
  summary_text = create_prediction_summary(prediction_data)
3022
 
3023
- return genesis_fig, summary_text
3024
-
3025
  except Exception as e:
3026
  import traceback
3027
  error_msg = f"Genesis prediction failed: {str(e)}\n\nDetails:\n{traceback.format_exc()}"
3028
  logging.error(error_msg)
3029
  err_fig = create_error_plot(error_msg)
3030
- return err_fig, error_msg
 
3031
 
3032
  generate_genesis_btn.click(
3033
  fn=run_genesis_prediction,
 
25
  import cartopy.feature as cfeature
26
  import plotly.graph_objects as go
27
  import plotly.express as px
28
+ import plotly.io as pio
29
  from plotly.subplots import make_subplots
30
 
31
  from sklearn.manifold import TSNE
 
3005
  """)
3006
 
3007
  with gr.Row():
3008
+ genesis_animation = gr.HTML(label="๐Ÿ—บ๏ธ Daily Genesis Potential & Storm Development")
3009
 
3010
  with gr.Row():
3011
  genesis_summary = gr.Textbox(label="๐Ÿ“‹ Monthly Genesis Analysis Summary", lines=25)
 
3014
  try:
3015
  # Generate monthly prediction using GPI
3016
  prediction_data = generate_genesis_prediction_monthly(month, oni, year=2025)
3017
+
3018
+ # Create animation figure
3019
  genesis_fig = create_genesis_animation(prediction_data, animation)
3020
 
3021
+ # Convert to HTML for reliable interactivity
3022
+ genesis_html = pio.to_html(genesis_fig, include_plotlyjs='cdn', full_html=False)
3023
+
3024
  # Generate summary
3025
  summary_text = create_prediction_summary(prediction_data)
3026
 
3027
+ return genesis_html, summary_text
3028
+
3029
  except Exception as e:
3030
  import traceback
3031
  error_msg = f"Genesis prediction failed: {str(e)}\n\nDetails:\n{traceback.format_exc()}"
3032
  logging.error(error_msg)
3033
  err_fig = create_error_plot(error_msg)
3034
+ err_html = pio.to_html(err_fig, include_plotlyjs='cdn', full_html=False)
3035
+ return err_html, error_msg
3036
 
3037
  generate_genesis_btn.click(
3038
  fn=run_genesis_prediction,