Spaces:
Sleeping
Sleeping
Update app.py
Browse files992 unmodified lines9939949959969979989991000100110025 unmodified lines1008100910101011101210132000 unmodified lines3014301530163017301830193020302130223023302430255 unmodified lines3031303230333034303530363037992 unmodified linesstorm_predictions = []for i, genesis in enumerate(genesis_events):storm_track = generate_storm_track_from_genesis(genesis['lat'],genesis['lon'],genesis['day'],month,oni_value,storm_id=i+1)5 unmodified lines'track': storm_track,'uncertainty': calculate_track_uncertainty(storm_track)})return {'month': month,2000 unmodified linestry:# Generate monthly prediction using GPIprediction_data = generate_genesis_prediction_monthly(month, oni, year=2025)# Create animation figuregenesis_fig = create_genesis_animation(prediction_data, animation)# Convert to HTML for reliable interactivitygenesis_html = pio.to_html(genesis_fig, include_plotlyjs='cdn', full_html=False)# Generate summarysummary_text = create_prediction_summary(prediction_data)5 unmodified lineserror_msg = f"Genesis prediction failed: {str(e)}\n\nDetails:\n{traceback.format_exc()}"logging.error(error_msg)err_fig = create_error_plot(error_msg)err_html = pio.to_html(err_fig, include_plotlyjs='cdn', full_html=False)return err_html, error_msggenerate_genesis_btn.click(992 unmodified lines9939949959969979989991000100110025 unmodified lines10081009101010111012101310141015101610172000 unmodified lines30183019302030213022302330243025302630273028302930303031303230333034303530365 unmodified lines3042304330443045304630473048992 unmodified linesstorm_predictions = []for i, genesis in enumerate(genesis_events):storm_track = generate_storm_track_from_genesis(genesis['lat'],genesis['lon'],genesis['day'],month,oni_value,storm_id=i+1)5 unmodified lines'track': storm_track,'uncertainty': calculate_track_uncertainty(storm_track)})logging.info(f"Monthly genesis prediction: {len(genesis_events)} events, {len(storm_predictions)} tracks")return {'month': month,2000 unmodified linestry:# Generate monthly prediction using GPIprediction_data = generate_genesis_prediction_monthly(month, oni, year=2025)logging.info(f"Genesis prediction run for month={month}, oni={oni}: {len(prediction_data.get('genesis_events', []))} events")# Create animation figuregenesis_fig = create_genesis_animation(prediction_data, animation)# Convert to HTML with inline Plotly JS for HF Spaces without CDN accessgenesis_html = pio.to_html(genesis_fig,include_plotlyjs='inline',full_html=False)# Generate summarysummary_text = create_prediction_summary(prediction_data)5 unmodified lineserror_msg = f"Genesis prediction failed: {str(e)}\n\nDetails:\n{traceback.format_exc()}"logging.error(error_msg)err_fig = create_error_plot(error_msg)err_html = pio.to_html(err_fig, include_plotlyjs='inline', full_html=False)return err_html, error_msggenerate_genesis_btn.click(
app.py+18-7