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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -3,15 +3,16 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
3
  import torch
4
  import os
5
 
6
- # Retrieve the token from environment variables
7
- api_token = os.getenv("HF_TOKEN")
8
 
9
- # Load the Hugging Face model and tokenizer with authentication
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
  # Define the function to process user input
16
  def generate_response(input_text):
17
  try:
 
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
17
  def generate_response(input_text):
18
  try: