dwb2023 commited on
Commit
def12f5
1 Parent(s): 5e040c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -4,7 +4,12 @@ import gradio as gr
4
  from magika import Magika
5
  from huggingface_hub import login
6
 
7
- login()
 
 
 
 
 
8
 
9
  SUPPORTED_FILE_TYPES = ["txt", "python", "markdown", "yaml", "json", "csv", "tsv", "xml", "html"]
10
 
 
4
  from magika import Magika
5
  from huggingface_hub import login
6
 
7
+ # Get the HF token from environment variables
8
+ hf_token = os.getenv("HF_TOKEN")
9
+ if hf_token:
10
+ login(token=hf_token)
11
+ else:
12
+ raise ValueError("HF_TOKEN environment variable is not set")
13
 
14
  SUPPORTED_FILE_TYPES = ["txt", "python", "markdown", "yaml", "json", "csv", "tsv", "xml", "html"]
15