Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# Cargar el modelo y el tokenizador
|
| 5 |
model_name = "meta-llama/Llama-3.2-1B-Instruct" # Aseg煤rate de que este sea el nombre correcto
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from dotenv import load_dotenv
|
| 3 |
import gradio as gr
|
| 4 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 5 |
+
from huggingface_hub import login
|
| 6 |
+
|
| 7 |
+
# Cargar las variables de entorno desde el archivo .env
|
| 8 |
+
load_dotenv()
|
| 9 |
+
|
| 10 |
+
# Iniciar sesi贸n en Hugging Face usando la variable de entorno
|
| 11 |
+
huggingface_token = os.getenv('HUGGINGFACE_TOKEN')
|
| 12 |
+
if huggingface_token is None:
|
| 13 |
+
raise ValueError("El token de Hugging Face no est谩 configurado en las variables de entorno.")
|
| 14 |
+
login(huggingface_token)
|
| 15 |
|
| 16 |
# Cargar el modelo y el tokenizador
|
| 17 |
model_name = "meta-llama/Llama-3.2-1B-Instruct" # Aseg煤rate de que este sea el nombre correcto
|