Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import streamlit as st
|
2 |
import numpy as np
|
3 |
import pandas as pd
|
@@ -5,10 +6,20 @@ import matplotlib.pyplot as plt
|
|
5 |
import seaborn as sns
|
6 |
import cv2
|
7 |
import torch
|
8 |
-
from huggingface_hub import hf_hub_download
|
9 |
from PIL import Image
|
10 |
import pickle
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Cargar dataset
|
14 |
dataset_repo = "VicGerardoPR/Traffic_sign_dataset"
|
|
|
1 |
+
import os
|
2 |
import streamlit as st
|
3 |
import numpy as np
|
4 |
import pandas as pd
|
|
|
6 |
import seaborn as sns
|
7 |
import cv2
|
8 |
import torch
|
9 |
+
from huggingface_hub import hf_hub_download
|
10 |
from PIL import Image
|
11 |
import pickle
|
12 |
|
13 |
+
# Obtener el token de Hugging Face desde las variables de entorno
|
14 |
+
hf_token = os.getenv("HF_API_TOKEN")
|
15 |
+
|
16 |
+
if hf_token is None:
|
17 |
+
st.error("El token de Hugging Face no está configurado. Por favor, configura el secreto 'HF_API_TOKEN'.")
|
18 |
+
st.stop()
|
19 |
+
|
20 |
+
# Autenticarse con el token
|
21 |
+
from huggingface_hub import login
|
22 |
+
login(token=hf_token)
|
23 |
|
24 |
# Cargar dataset
|
25 |
dataset_repo = "VicGerardoPR/Traffic_sign_dataset"
|