Bmo411 commited on
Commit
c23f576
verified
1 Parent(s): c08fba8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -7,14 +7,16 @@ from huggingface_hub import hf_hub_download
7
  # Descargar modelo desde Hugging Face
8
  model_path = hf_hub_download(repo_id="Bmo411/DenoisingAutoencoder", filename="autoencoder_complete_model_Fourier.keras")
9
 
10
- # Cargar el modelo una sola vez para evitar recargas en cada ejecuci贸n
11
- model = tf.keras.models.load_model(model_path, compile=True)
 
12
  def fourier_transform(x):
13
  fourier = tf.signal.fft2d(tf.cast(x, tf.complex64))
14
  fourier = tf.complex(tf.math.real(fourier), tf.math.imag(fourier))
15
  fourier = tf.abs(fourier)
16
- return tf.concat([tf.math.real(fourier), tf.math.imag(fourier)], axis=-1) # Separar parte real e imaginaria
17
 
 
18
  def inverse_fourier_transform(x):
19
  real_part, imag_part = tf.split(x, num_or_size_splits=2, axis=-1)
20
  complex_fourier = tf.complex(real_part, imag_part)
 
7
  # Descargar modelo desde Hugging Face
8
  model_path = hf_hub_download(repo_id="Bmo411/DenoisingAutoencoder", filename="autoencoder_complete_model_Fourier.keras")
9
 
10
+ from tensorflow.keras.saving import register_keras_serializable
11
+
12
+ @register_keras_serializable()
13
  def fourier_transform(x):
14
  fourier = tf.signal.fft2d(tf.cast(x, tf.complex64))
15
  fourier = tf.complex(tf.math.real(fourier), tf.math.imag(fourier))
16
  fourier = tf.abs(fourier)
17
+ return tf.concat([tf.math.real(fourier), tf.math.imag(fourier)], axis=-1)
18
 
19
+ @register_keras_serializable()
20
  def inverse_fourier_transform(x):
21
  real_part, imag_part = tf.split(x, num_or_size_splits=2, axis=-1)
22
  complex_fourier = tf.complex(real_part, imag_part)