Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 3 |
import torch
|
|
|
|
| 4 |
|
| 5 |
-
#
|
|
|
|
|
|
|
|
|
|
| 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):
|