AiiTServices / core /pre_processing.py
HenriqueBraz's picture
Update core/pre_processing.py
9633d44 verified
raw
history blame contribute delete
372 Bytes
import re
from PIL import Image
def clean_text(text):
text = re.sub(r"<[^>]+>", "", text) # Remove HTML
text = re.sub(r"[^a-zA-ZÀ-ÿ0-9\s]", "", text) # Remove caracteres especiais
return text.strip()
def resize_image(image, size=(224, 224)):
return image.resize(size)
def normalize_audio(audio_array):
return audio_array / max(abs(audio_array))