Update app.py
Browse files
app.py
CHANGED
@@ -8,12 +8,12 @@ from torchvision.transforms import Resize
|
|
8 |
# Define the model and processor
|
9 |
model_id = "0llheaven/Llama-3.2-11B-Vision-Radiology-mini"
|
10 |
|
11 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
12 |
model = MllamaForConditionalGeneration.from_pretrained(
|
13 |
model_id,
|
14 |
# load_in_4bit=True,
|
15 |
torch_dtype=torch.bfloat16,
|
16 |
-
device_map=
|
17 |
)
|
18 |
|
19 |
model.gradient_checkpointing_enable()
|
@@ -51,7 +51,7 @@ interface = gr.Interface(
|
|
51 |
fn=generate_description,
|
52 |
inputs=gr.Image(type="pil", label="Upload an Image"),
|
53 |
outputs=gr.Textbox(label="Generated Description"),
|
54 |
-
live=True,
|
55 |
title="Radiology Image Description Generator",
|
56 |
description="Upload an image and provide an instruction to generate a description using a vision-language model."
|
57 |
)
|
|
|
8 |
# Define the model and processor
|
9 |
model_id = "0llheaven/Llama-3.2-11B-Vision-Radiology-mini"
|
10 |
|
11 |
+
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
12 |
model = MllamaForConditionalGeneration.from_pretrained(
|
13 |
model_id,
|
14 |
# load_in_4bit=True,
|
15 |
torch_dtype=torch.bfloat16,
|
16 |
+
device_map="auto",
|
17 |
)
|
18 |
|
19 |
model.gradient_checkpointing_enable()
|
|
|
51 |
fn=generate_description,
|
52 |
inputs=gr.Image(type="pil", label="Upload an Image"),
|
53 |
outputs=gr.Textbox(label="Generated Description"),
|
54 |
+
# live=True,
|
55 |
title="Radiology Image Description Generator",
|
56 |
description="Upload an image and provide an instruction to generate a description using a vision-language model."
|
57 |
)
|