Update README.md
Browse files
README.md
CHANGED
@@ -29,10 +29,8 @@ Train Set, Test Set This dataset represents 0.33% of the original dataset found
|
|
29 |
## Usage
|
30 |
|
31 |
```python
|
32 |
-
from typing import Optional
|
33 |
-
import gradio as gr
|
34 |
-
from gradio import Interface
|
35 |
from unsloth import FastVisionModel
|
|
|
36 |
import numpy as np
|
37 |
import torch
|
38 |
|
@@ -75,19 +73,11 @@ def predict_radiology_description(image, instruction):
|
|
75 |
except Exception as e:
|
76 |
return f"Error: {str(e)}"
|
77 |
|
78 |
-
#
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
value="You are an expert radiographer. Describe accurately what you see in this image.",
|
86 |
-
label="Instruction"),
|
87 |
-
],
|
88 |
-
outputs="text",
|
89 |
-
title="radiology image description generate",
|
90 |
-
description="Upload an image and provide instructions to generate radiology descriptions.\nExample instruction : You are an expert radiographer. Describe accurately what you see in this image.",
|
91 |
-
)
|
92 |
-
demo.launch(server_port=8030, debug=True)
|
93 |
```
|
|
|
29 |
## Usage
|
30 |
|
31 |
```python
|
|
|
|
|
|
|
32 |
from unsloth import FastVisionModel
|
33 |
+
from PIL import Image
|
34 |
import numpy as np
|
35 |
import torch
|
36 |
|
|
|
73 |
except Exception as e:
|
74 |
return f"Error: {str(e)}"
|
75 |
|
76 |
+
# Example of usage!
|
77 |
+
image_path = 'image.jpeg'
|
78 |
+
instruction = 'You are an expert radiographer. Describe accurately what you see in this image.'
|
79 |
+
|
80 |
+
image = Image.open(image_path).convert("RGB")
|
81 |
+
output = predict_radiology_description(image, instruction)
|
82 |
+
print(output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
```
|