sounar commited on
Commit
fa9231d
·
verified ·
1 Parent(s): 5f6d422

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -3,14 +3,23 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
3
  import torch
4
  import os
5
 
6
- # Retrieve the token and strip any whitespace or newline characters
7
  api_token = os.getenv("HF_TOKEN").strip()
8
 
9
- # Load the Hugging Face model and tokenizer with the cleaned token
10
  model_name = "ContactDoctor/Bio-Medical-MultiModal-Llama-3-8B-V1"
11
- tokenizer = AutoTokenizer.from_pretrained(model_name, use_auth_token=api_token)
12
- model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True, use_auth_token=api_token)
13
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
 
16
  # Define the function to process user input
 
3
  import torch
4
  import os
5
 
6
+ # Retrieve the token from environment variables
7
  api_token = os.getenv("HF_TOKEN").strip()
8
 
9
+ # Model name
10
  model_name = "ContactDoctor/Bio-Medical-MultiModal-Llama-3-8B-V1"
 
 
11
 
12
+ # Load the Hugging Face model and tokenizer with required arguments
13
+ tokenizer = AutoTokenizer.from_pretrained(
14
+ model_name,
15
+ use_auth_token=api_token, # Authenticate with Hugging Face token
16
+ trust_remote_code=True # Allow custom code from the repository
17
+ )
18
+ model = AutoModelForCausalLM.from_pretrained(
19
+ model_name,
20
+ use_auth_token=api_token, # Authenticate with Hugging Face token
21
+ trust_remote_code=True # Allow custom code from the repository
22
+ )
23
 
24
 
25
  # Define the function to process user input