Update app.py
Browse files
app.py
CHANGED
|
@@ -4,12 +4,14 @@ from PIL import Image
|
|
| 4 |
import torch
|
| 5 |
import os
|
| 6 |
from huggingface_hub import login
|
|
|
|
| 7 |
|
| 8 |
# Load the model
|
| 9 |
model = AutoModel.from_pretrained("jcsagar/CXR-LLAVA-v2", trust_remote_code=True)
|
| 10 |
model = model.to("cuda")
|
| 11 |
|
| 12 |
# Define the function to generate the report
|
|
|
|
| 13 |
def generate_report(image):
|
| 14 |
image = Image.open(image).convert("RGB")
|
| 15 |
response = model.write_radiologic_report(image)
|
|
|
|
| 4 |
import torch
|
| 5 |
import os
|
| 6 |
from huggingface_hub import login
|
| 7 |
+
import spaces
|
| 8 |
|
| 9 |
# Load the model
|
| 10 |
model = AutoModel.from_pretrained("jcsagar/CXR-LLAVA-v2", trust_remote_code=True)
|
| 11 |
model = model.to("cuda")
|
| 12 |
|
| 13 |
# Define the function to generate the report
|
| 14 |
+
@spaces.GPU
|
| 15 |
def generate_report(image):
|
| 16 |
image = Image.open(image).convert("RGB")
|
| 17 |
response = model.write_radiologic_report(image)
|