k-m-irfan commited on
Commit
e8b97c8
·
verified ·
1 Parent(s): 716fb1b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +52 -1
README.md CHANGED
@@ -21,12 +21,63 @@ tags:
21
  [![Paper](https://img.shields.io/badge/arXiv-Paper-<COLOR>.svg)](https://arxiv.org/abs/2412.07769)
22
  [![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey)](https://github.com/mbzuai-oryx/BiMediX/blob/main/LICENSE.txt)
23
 
 
 
24
  ```
25
- # Requires
26
  vllm==0.6.1.post1
27
  transformers==4.45.2
28
  ```
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ## License & Citation
31
 
32
  BiMediX2 is released under the CC-BY-NC-SA 4.0 License. For more details, please refer to the [LICENSE](https://github.com/mbzuai-oryx/BiMediX/blob/main/LICENSE.txt) file included in our BiMediX repository.
 
21
  [![Paper](https://img.shields.io/badge/arXiv-Paper-<COLOR>.svg)](https://arxiv.org/abs/2412.07769)
22
  [![License](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey)](https://github.com/mbzuai-oryx/BiMediX/blob/main/LICENSE.txt)
23
 
24
+
25
+ ### Requires
26
  ```
 
27
  vllm==0.6.1.post1
28
  transformers==4.45.2
29
  ```
30
 
31
+ ### Serve usig vLLM
32
+ ```
33
+ vllm serve MBZUAI/BiMediX2-8B-hf \
34
+ --tensor-parallel-size 2 \
35
+ --max-model-len 32000 \
36
+ --port 8000 \
37
+ --trust-remote-code
38
+ ```
39
+
40
+ ### Openai compatible API:
41
+ ```
42
+ from openai import OpenAI
43
+ import base64
44
+ import io
45
+ from PIL import Image
46
+
47
+ client = OpenAI(
48
+ base_url="http://localhost:8000/v1/",
49
+ api_key="DUMMY_KEY",
50
+ )
51
+
52
+ image = Image.open("image_path").convert("RGB") # for local Image (use image URL directly for online image)
53
+
54
+ completion = client.chat.completions.create(
55
+ model="MBZUAI/BiMediX2-8B-hf",
56
+ messages=[
57
+ {
58
+ "role": "user",
59
+ "content": [
60
+ {
61
+ "type": "image_url",
62
+ "image_url": {
63
+ "url": f"data:image/jpeg;base64,{base64.b64encode(io.BytesIO(image.save(buf := io.BytesIO(), format='JPEG') or buf.getvalue()).getvalue()).decode()}"
64
+ }
65
+ },
66
+ {
67
+ "type": "text",
68
+ "text": "Describe the image in detail."
69
+ }
70
+ ]
71
+ }
72
+ ],
73
+ max_tokens=4096,
74
+ temperature=0.1,
75
+ top_p=0.9
76
+ )
77
+
78
+ print(completion.choices[0].message)
79
+ ```
80
+
81
  ## License & Citation
82
 
83
  BiMediX2 is released under the CC-BY-NC-SA 4.0 License. For more details, please refer to the [LICENSE](https://github.com/mbzuai-oryx/BiMediX/blob/main/LICENSE.txt) file included in our BiMediX repository.