GiantPandas commited on
Commit
ed5f075
·
verified ·
1 Parent(s): b627c1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -9
app.py CHANGED
@@ -298,15 +298,31 @@ def render_img(b64_list, idx, scale):
298
 
299
  if scale <= 1:
300
  # ---------- 居中模式 ----------
301
- return (
302
- f'<div style="overflow:auto;border:1px solid #ccc;'
303
- f'display:flex;justify-content:center;align-items:center;'
304
- f'width:100%;height:800px;">'
305
- f' <img src="{src}" '
306
- f' style="width:{percent}%;max-width:none;'
307
- f' height:auto;display:block;" />'
308
- f'</div>'
309
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  else:
311
  # ---------- 放大模式 ----------
312
  return (
 
298
 
299
  if scale <= 1:
300
  # ---------- 居中模式 ----------
301
+ # return (
302
+ # f'<div style="overflow:auto;border:1px solid #ccc;'
303
+ # f'display:flex;justify-content:center;align-items:center;'
304
+ # f'width:100%;height:800px;">'
305
+ # f' <img src="{src}" '
306
+ # f' style="width:{percent}%;max-width:none;'
307
+ # f' height:auto;display:block;" />'
308
+ # f'</div>'
309
+ # )
310
+
311
+ return f'''
312
+ <div style="
313
+ overflow:auto;border:1px solid #ccc;
314
+ display:flex;
315
+ justify-content:center;
316
+ align-items:center; /* 垂直也居中 */
317
+ width:100%;height:800px;">
318
+ <img src="{src}"
319
+ style="
320
+ width:{percent}%;
321
+ max-width:none;
322
+ height:auto;
323
+ flex-shrink:0;" />
324
+ </div>
325
+ '''
326
  else:
327
  # ---------- 放大模式 ----------
328
  return (