Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,7 +40,6 @@ def process_data(image, text):
|
|
40 |
# Process image: Resize and convert to base64
|
41 |
img_str = ""
|
42 |
if image is not None:
|
43 |
-
image = Image.open(BytesIO(image))
|
44 |
# Resize image, maintaining aspect ratio, and max width 1024 pixels
|
45 |
base_width = 1024
|
46 |
w_percent = (base_width / float(image.size[0]))
|
@@ -52,6 +51,7 @@ def process_data(image, text):
|
|
52 |
image.save(buffered, format="JPEG")
|
53 |
img_str = base64.b64encode(buffered.getvalue()).decode('utf-8')
|
54 |
|
|
|
55 |
# Prepare data object
|
56 |
obj = Base()
|
57 |
obj["image"] = img_str
|
|
|
40 |
# Process image: Resize and convert to base64
|
41 |
img_str = ""
|
42 |
if image is not None:
|
|
|
43 |
# Resize image, maintaining aspect ratio, and max width 1024 pixels
|
44 |
base_width = 1024
|
45 |
w_percent = (base_width / float(image.size[0]))
|
|
|
51 |
image.save(buffered, format="JPEG")
|
52 |
img_str = base64.b64encode(buffered.getvalue()).decode('utf-8')
|
53 |
|
54 |
+
|
55 |
# Prepare data object
|
56 |
obj = Base()
|
57 |
obj["image"] = img_str
|