vykanand commited on
Commit
6f17c34
Β·
verified Β·
1 Parent(s): 2319467

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import torch
2
  from PIL import Image
3
  import requests
 
4
  from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
5
  from qwen_vl_utils import process_vision_info
6
 
@@ -19,7 +20,7 @@ processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct")
19
  # Resize the image to a smaller resolution (e.g., 512x512)
20
  image_url = "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"
21
  response = requests.get(image_url)
22
- img = Image.open(BytesIO(response.content))
23
 
24
  # Resize the image
25
  img_resized = img.resize((512, 512)) # Resize the image to 512x512
 
1
  import torch
2
  from PIL import Image
3
  import requests
4
+ from io import BytesIO # Importing BytesIO from the io module
5
  from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
6
  from qwen_vl_utils import process_vision_info
7
 
 
20
  # Resize the image to a smaller resolution (e.g., 512x512)
21
  image_url = "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg"
22
  response = requests.get(image_url)
23
+ img = Image.open(BytesIO(response.content)) # Using BytesIO to handle image from the byte stream
24
 
25
  # Resize the image
26
  img_resized = img.resize((512, 512)) # Resize the image to 512x512