Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,29 +22,20 @@ class AppConfig:
|
|
22 |
|
23 |
MAX_SEED = AppConfig.MAX_SEED
|
24 |
|
25 |
-
|
26 |
-
tokens = tokens or [
|
27 |
-
os.environ.get("HF_TOKEN"),
|
28 |
-
os.environ.get("HF_TOKEN1"),
|
29 |
-
os.environ.get("HF_TOKEN2"),
|
30 |
-
os.environ.get("HF_TOKEN3")
|
31 |
-
]
|
32 |
-
|
33 |
-
for token in tokens:
|
34 |
-
if not token:
|
35 |
-
continue
|
36 |
-
try:
|
37 |
-
client = InferenceClient(token=token)
|
38 |
-
client.text_generation("Test", max_length=10)
|
39 |
-
return client
|
40 |
-
except Exception as e:
|
41 |
-
st.warning(f"Token fallido: {token[:5]}...")
|
42 |
-
|
43 |
-
st.error("Todos los tokens de HuggingFace han fallado")
|
44 |
-
return None
|
45 |
|
46 |
DATA_PATH = Path("./data")
|
47 |
DATA_PATH.mkdir(exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
client = get_inference_client()
|
49 |
|
50 |
def authenticate_user(username, password):
|
|
|
22 |
|
23 |
MAX_SEED = AppConfig.MAX_SEED
|
24 |
|
25 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
DATA_PATH = Path("./data")
|
28 |
DATA_PATH.mkdir(exist_ok=True)
|
29 |
+
|
30 |
+
def get_inference_client():
|
31 |
+
try:
|
32 |
+
client = InferenceClient(token=HF_TOKEN)
|
33 |
+
client.text_generation("Test", max_length=10)
|
34 |
+
return client
|
35 |
+
except Exception as e:
|
36 |
+
st.error("No se pudo establecer conexi贸n con Hugging Face.")
|
37 |
+
return None
|
38 |
+
|
39 |
client = get_inference_client()
|
40 |
|
41 |
def authenticate_user(username, password):
|