Mageia commited on
Commit
86b715d
·
unverified ·
1 Parent(s): c2cdc57

fix: Gallery

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -118,7 +118,13 @@ def fine_grained_update(fine_grained_type):
118
 
119
  with gr.Blocks() as demo:
120
  pdf_input = gr.File(label="上传PDF文件")
121
- image_gallery = gr.Gallery(label="PDF页面预览", columns=3, height="300")
 
 
 
 
 
 
122
  selected_index = gr.State(None)
123
  pdf_input.upload(fn=process_pdf, inputs=pdf_input, outputs=image_gallery)
124
  image_gallery.select(fn=on_image_select, inputs=[], outputs=selected_index)
 
118
 
119
  with gr.Blocks() as demo:
120
  pdf_input = gr.File(label="上传PDF文件")
121
+ image_gallery = gr.Gallery(
122
+ label="PDF页面预览",
123
+ columns=3,
124
+ height=300,
125
+ object_fit="contain", # 添加这个参数
126
+ preview=True, # 添加这个参数
127
+ )
128
  selected_index = gr.State(None)
129
  pdf_input.upload(fn=process_pdf, inputs=pdf_input, outputs=image_gallery)
130
  image_gallery.select(fn=on_image_select, inputs=[], outputs=selected_index)