Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,14 +3,23 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
| 3 |
import torch
|
| 4 |
import os
|
| 5 |
|
| 6 |
-
# Retrieve the token
|
| 7 |
api_token = os.getenv("HF_TOKEN").strip()
|
| 8 |
|
| 9 |
-
#
|
| 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
|