ovieyra21 commited on
Commit
534b180
·
verified ·
1 Parent(s): 05b40ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -1,6 +1,16 @@
 
1
  import gradio as gr
2
  import torch
3
  from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub
 
 
 
 
 
 
 
 
 
4
 
5
  # Cargar el modelo
6
  models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
 
1
+ import os
2
  import gradio as gr
3
  import torch
4
  from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub
5
+ from huggingface_hub import login
6
+
7
+ # Obtener el token desde las variables de entorno
8
+ hf_token = os.getenv("HF_TOKEN")
9
+ if hf_token is None:
10
+ raise ValueError("Debe proporcionar un token de Hugging Face en las variables de entorno.")
11
+
12
+ # Ingresar el token
13
+ login(hf_token)
14
 
15
  # Cargar el modelo
16
  models, cfg, task = load_model_ensemble_and_task_from_hf_hub(