Spaces:
Runtime error
Runtime error
init
Browse files- llava/serve/gradio_web_server.py +10 -2
- pyproject.toml +1 -1
llava/serve/gradio_web_server.py
CHANGED
|
@@ -31,6 +31,7 @@ from PIL import Image
|
|
| 31 |
import io
|
| 32 |
import base64
|
| 33 |
|
|
|
|
| 34 |
def resize_image(image, default_width=(1344, 896), request_width=None):
|
| 35 |
# 如果 request 中指定了 width,则使用传入的值
|
| 36 |
if request_width:
|
|
@@ -38,7 +39,7 @@ def resize_image(image, default_width=(1344, 896), request_width=None):
|
|
| 38 |
|
| 39 |
original_width, original_height = image.size
|
| 40 |
|
| 41 |
-
print(original_width,original_height)
|
| 42 |
|
| 43 |
# 根据宽高比决定 resize 逻辑
|
| 44 |
if original_width >= original_height:
|
|
@@ -54,7 +55,14 @@ def resize_image(image, default_width=(1344, 896), request_width=None):
|
|
| 54 |
|
| 55 |
# 调整图像大小
|
| 56 |
resized_image = image.resize((new_width, new_height))
|
| 57 |
-
print(new_width,new_height)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
return resized_image
|
| 59 |
|
| 60 |
|
|
|
|
| 31 |
import io
|
| 32 |
import base64
|
| 33 |
|
| 34 |
+
|
| 35 |
def resize_image(image, default_width=(1344, 896), request_width=None):
|
| 36 |
# 如果 request 中指定了 width,则使用传入的值
|
| 37 |
if request_width:
|
|
|
|
| 39 |
|
| 40 |
original_width, original_height = image.size
|
| 41 |
|
| 42 |
+
print("Original size:", original_width, original_height)
|
| 43 |
|
| 44 |
# 根据宽高比决定 resize 逻辑
|
| 45 |
if original_width >= original_height:
|
|
|
|
| 55 |
|
| 56 |
# 调整图像大小
|
| 57 |
resized_image = image.resize((new_width, new_height))
|
| 58 |
+
print("After initial resize:", new_width, new_height)
|
| 59 |
+
|
| 60 |
+
# 如果高度仍然超过 2016,则将图片固定调整为 896x2016
|
| 61 |
+
if new_height > 2016:
|
| 62 |
+
new_width, new_height = 672, 2016
|
| 63 |
+
resized_image = resized_image.resize((new_width, new_height))
|
| 64 |
+
print("Adjusted to fixed size:", new_width, new_height)
|
| 65 |
+
|
| 66 |
return resized_image
|
| 67 |
|
| 68 |
|
pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
| 4 |
|
| 5 |
[project]
|
| 6 |
name = "uground_demo_test"
|
| 7 |
-
version = "3.
|
| 8 |
description = "Navigating the Digital World as Humans Do: Universal Visual Grounding for GUI Agents"
|
| 9 |
readme = "README.md"
|
| 10 |
requires-python = ">=3.8"
|
|
|
|
| 4 |
|
| 5 |
[project]
|
| 6 |
name = "uground_demo_test"
|
| 7 |
+
version = "3.6"
|
| 8 |
description = "Navigating the Digital World as Humans Do: Universal Visual Grounding for GUI Agents"
|
| 9 |
readme = "README.md"
|
| 10 |
requires-python = ">=3.8"
|