Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -277,6 +277,19 @@ def to_file(image_path):
|
|
| 277 |
|
| 278 |
return image_path
|
| 279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 280 |
|
| 281 |
|
| 282 |
|
|
|
|
| 277 |
|
| 278 |
return image_path
|
| 279 |
|
| 280 |
+
def render_img(b64_list, idx, scale):
|
| 281 |
+
"""根据当前索引 idx 和缩放倍数 scale 渲染 HTML。"""
|
| 282 |
+
if not b64_list:
|
| 283 |
+
return "<p style='color:gray'>请先上传图片</p>"
|
| 284 |
+
idx %= len(b64_list) # 防止越界
|
| 285 |
+
src = b64_list[idx]
|
| 286 |
+
return (
|
| 287 |
+
f'<div style="overflow:auto;border:1px solid #ccc;'
|
| 288 |
+
f'width:100%;height:800px;text-align:center">'
|
| 289 |
+
f'<img src="{src}" '
|
| 290 |
+
f'style="transform:scale({scale});transform-origin:0 0;" />'
|
| 291 |
+
f'</div>'
|
| 292 |
+
)
|
| 293 |
|
| 294 |
|
| 295 |
|