Instructions to use sharktide/FlashFloodNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use sharktide/FlashFloodNet with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://sharktide/FlashFloodNet") - Notebooks
- Google Colab
- Kaggle
| from tensorflow.keras.saving import register_keras_serializable | |
| from tensorflow.keras import layers, models, backend as K | |
| import tensorflow as tf | |
| def drainage_penalty(inputs): | |
| dd = inputs[:, 2] | |
| return (1.0 - 0.4 * tf.sigmoid((dd - 3.5) * 2))[:, None] | |
| def convergence_suppressor(inputs): | |
| ci = inputs[:, 4] | |
| return (1.0 + 0.3 * tf.sigmoid((ci - 0.5) * 8))[:, None] | |
| def intensity_slope_amplifier(inputs): | |
| rainfall_intensity = inputs[:, 0] | |
| slope = inputs[:, 1] | |
| runoff_boost = tf.sigmoid((rainfall_intensity - 75) * 0.08) | |
| slope_boost = tf.sigmoid((slope - 10) * 0.05) | |
| return (1.0 + 0.35 * runoff_boost * slope_boost)[:, None] | |
| def clip_modulation(x): | |
| return tf.clip_by_value(x, 0.7, 1.3) | |
| CUSTOM_OBJECTS = { | |
| 'drainage_penalty': drainage_penalty, | |
| 'intensity_slope_amplifier': intensity_slope_amplifier, | |
| 'convergence_suppressor': convergence_suppressor, | |
| 'clip_modulation': clip_modulation | |
| } |