Spaces:
Build error
Build error
Update app.py
Browse files4 unmodified lines56789101112131415161718192021229 unmodified lines3233343536373839404 unmodified linesimport seaborn as snsimport cv2import torchfrom transformers import AutoTokenizer, AutoModelForImageClassificationfrom huggingface_hub import hf_hub_downloadfrom PIL import Imageimport pickle# Cargar datasetdataset_repo = "VicGerardoPR/Traffic_sign_dataset"dataset_file = "train.p"dataset_path = hf_hub_download(repo_id=dataset_repo, filename=dataset_file)with open(dataset_path, 'rb') as file:train_data = pickle.load(file)train_images, train_labels = train_data['features'], train_data['labels']9 unmodified linesmodel_repo = "VicGerardoPR/Traffic_sign_model"model_file = "traffic_sign_classifier.h5"model_path = hf_hub_download(repo_id=model_repo, filename=model_file)model = torch.load(model_path, map_location=torch.device('cpu'))model.eval()# Diccionario de clases de señales de tráficoclasses = {4 unmodified lines5678910111213141516171819202122232425269 unmodified lines36373839404142434445464748494 unmodified linesimport seaborn as snsimport cv2import torchfrom huggingface_hub import hf_hub_download, loginfrom PIL import Imageimport pickle# Cargar datasetdataset_repo = "VicGerardoPR/Traffic_sign_dataset"dataset_file = "train.p"try:dataset_path = hf_hub_download(repo_id=dataset_repo, filename=dataset_file, repo_type="dataset")with open(dataset_path, 'rb') as file:train_data = pickle.load(file)except Exception as e:st.error(f"Error al cargar el dataset: {e}")st.stop()train_images, train_labels = train_data['features'], train_data['labels']9 unmodified linesmodel_repo = "VicGerardoPR/Traffic_sign_model"model_file = "traffic_sign_classifier.h5"try:model_path = hf_hub_download(repo_id=model_repo, filename=model_file, repo_type="model")model = torch.load(model_path, map_location=torch.device('cpu'))model.eval()except Exception as e:st.error(f"Error al cargar el modelo: {e}")st.stop()# Diccionario de clases de señales de tráficoclasses = {
app.py+17-8