Sebastian Tinoco commited on
Commit
3a1f89a
1 Parent(s): 43f381b

specified token on HF

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -1,6 +1,8 @@
1
  from transformers import pipeline
2
  import torch
3
  import gradio as gr
 
 
4
  from utils import parse_args
5
 
6
 
@@ -9,6 +11,13 @@ args = parse_args()
9
  model = args['model']
10
  model_name = "clinical-assistance/" + model
11
 
 
 
 
 
 
 
 
12
  # Init model
13
  device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
14
  generate_kwargs = {"language":"<|es|>", "task": "transcribe"}
 
1
  from transformers import pipeline
2
  import torch
3
  import gradio as gr
4
+ import os
5
+ from huggingface_hub import login
6
  from utils import parse_args
7
 
8
 
 
11
  model = args['model']
12
  model_name = "clinical-assistance/" + model
13
 
14
+ # Load secrets
15
+ token = os.getenv("TOKEN")
16
+ assert token is not None, 'Hugging Face token has not been specified. Please specify your token in a .env file.'
17
+
18
+ # Login to Hugging Face
19
+ login(token=token)
20
+
21
  # Init model
22
  device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
23
  generate_kwargs = {"language":"<|es|>", "task": "transcribe"}