akhil2808 commited on
Commit
74be4e1
·
verified ·
1 Parent(s): d4eb915

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -2,7 +2,16 @@ import gradio as gr
2
  import torch
3
  from wenet.cli.model import load_model
4
 
 
 
5
 
 
 
 
 
 
 
 
6
 
7
  def process_cat_embs(cat_embs):
8
  device = "cpu"
 
2
  import torch
3
  from wenet.cli.model import load_model
4
 
5
+ import os
6
+ from huggingface_hub import login
7
 
8
+ # Load the API token from the environment variables
9
+ api_token = os.getenv('HUGGINGFACE_API_TOKEN')
10
+ if not api_token:
11
+ raise ValueError("No Hugging Face API token found. Please set the HUGGING_FACE_API_TOKEN environment variable.")
12
+
13
+ # Login to Hugging Face Hub
14
+ login(token=api_token, add_to_git_credential=True)
15
 
16
  def process_cat_embs(cat_embs):
17
  device = "cpu"