GiantPandas commited on
Commit
6ca95e4
·
verified ·
1 Parent(s): 043f8b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -451,6 +451,9 @@ if __name__ == '__main__':
451
 
452
  async def upload_handler(files):
453
 
 
 
 
454
  if files.lower().endswith(".pdf"):
455
  asyncio.create_task(send_pdf_async_aiohttp(files, server_ip=openai_api_base, Authorization=Authorization))
456
 
@@ -461,6 +464,10 @@ if __name__ == '__main__':
461
  upload_handler,
462
  inputs=file,
463
  outputs=[img_list_state, idx_state, viewer],
 
 
 
 
464
  )
465
 
466
  def show_prev(b64s, idx, scale):
 
451
 
452
  async def upload_handler(files):
453
 
454
+ if files is None:
455
+ return [], 0, ""
456
+
457
  if files.lower().endswith(".pdf"):
458
  asyncio.create_task(send_pdf_async_aiohttp(files, server_ip=openai_api_base, Authorization=Authorization))
459
 
 
464
  upload_handler,
465
  inputs=file,
466
  outputs=[img_list_state, idx_state, viewer],
467
+ ).then(
468
+ lambda: gr.Slider.update(value=1), # 无输入,直接把 zoom 设为 1
469
+ None, # inputs=None
470
+ zoom # outputs=[zoom]
471
  )
472
 
473
  def show_prev(b64s, idx, scale):