Spaces:
Sleeping
Sleeping
Update core/pre_processing.py
Browse files- core/pre_processing.py +13 -0
core/pre_processing.py
CHANGED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
from PIL import Image
|
3 |
+
|
4 |
+
def clean_text(text):
|
5 |
+
text = re.sub(r"<[^>]+>", "", text) # Remove HTML
|
6 |
+
text = re.sub(r"[^a-zA-ZÀ-ÿ0-9\s]", "", text) # Remove caracteres especiais
|
7 |
+
return text.strip()
|
8 |
+
|
9 |
+
def resize_image(image, size=(224, 224)):
|
10 |
+
return image.resize(size)
|
11 |
+
|
12 |
+
def normalize_audio(audio_array):
|
13 |
+
return audio_array / max(abs(audio_array))
|