Chris4K commited on
Commit
2db4342
·
verified ·
1 Parent(s): d8c0c59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  import torch
3
  from PIL import Image
@@ -5,16 +6,16 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
5
 
6
  MODEL_ID = "openbmb/MiniCPM-V-2_6"
7
 
8
- # Retrieve the Hugging Face token from Colab secrets
9
- #HF_TOKEN = userdata.get('HF_TOKEN')
10
 
11
- tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True )
12
  model = AutoModelForCausalLM.from_pretrained(
13
  MODEL_ID,
14
  trust_remote_code=True,
15
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
16
  device_map="auto",
17
- # token=HF_TOKEN # Pass the token here
18
  )
19
  model.eval()
20
 
 
1
+ import os
2
  import gradio as gr
3
  import torch
4
  from PIL import Image
 
6
 
7
  MODEL_ID = "openbmb/MiniCPM-V-2_6"
8
 
9
+ # Retrieve Hugging Face token from environment variables
10
+ HF_TOKEN = os.environ.get('HF_TOKEN')
11
 
12
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_ID, trust_remote_code=True)
13
  model = AutoModelForCausalLM.from_pretrained(
14
  MODEL_ID,
15
  trust_remote_code=True,
16
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
17
  device_map="auto",
18
+ token=HF_TOKEN # Pass the token here
19
  )
20
  model.eval()
21