added missing function definition
#19
by ajeet214 - opened
README.md
CHANGED
|
@@ -23,9 +23,20 @@ https://huggingface.co/spaces/showlab/ShowUI
|
|
| 23 |
import ast
|
| 24 |
import torch
|
| 25 |
from PIL import Image, ImageDraw
|
|
|
|
| 26 |
from qwen_vl_utils import process_vision_info
|
| 27 |
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
def draw_point(image_input, point=None, radius=5):
|
| 30 |
if isinstance(image_input, str):
|
| 31 |
image = Image.open(BytesIO(requests.get(image_input).content)) if image_input.startswith('http') else Image.open(image_input)
|
|
|
|
| 23 |
import ast
|
| 24 |
import torch
|
| 25 |
from PIL import Image, ImageDraw
|
| 26 |
+
import matplotlib.pyplot as plt
|
| 27 |
from qwen_vl_utils import process_vision_info
|
| 28 |
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
| 29 |
|
| 30 |
+
|
| 31 |
+
def display(image, figsize=(10, 20)):
|
| 32 |
+
if isinstance(image, str):
|
| 33 |
+
image = Image.open(BytesIO(requests.get(image).content)) if image.startswith('http') else Image.open(image)
|
| 34 |
+
plt.figure(figsize=figsize)
|
| 35 |
+
plt.imshow(image)
|
| 36 |
+
plt.axis('off')
|
| 37 |
+
plt.show()
|
| 38 |
+
|
| 39 |
+
|
| 40 |
def draw_point(image_input, point=None, radius=5):
|
| 41 |
if isinstance(image_input, str):
|
| 42 |
image = Image.open(BytesIO(requests.get(image_input).content)) if image_input.startswith('http') else Image.open(image_input)
|