sounar commited on
Commit
832ce7b
1 Parent(s): 06d4e81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -1,11 +1,16 @@
1
  import gradio as gr
2
  from transformers import AutoTokenizer, AutoModelForCausalLM
3
  import torch
 
4
 
5
- # Load the Hugging Face model and tokenizer
 
 
 
6
  model_name = "ContactDoctor/Bio-Medical-MultiModal-Llama-3-8B-V1"
7
- tokenizer = AutoTokenizer.from_pretrained(model_name)
8
- model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
 
9
 
10
  # Define the function to process user input
11
  def generate_response(input_text):
 
1
  import gradio as gr
2
  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):