0llheaven commited on
Commit
0a05d96
·
verified ·
1 Parent(s): 47bd524

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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=device,
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
  )