Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
11 |
-
|
|
|
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)
|
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)
|