Skip to content

Commit

Permalink
Merge pull request #226 from hellofinch/main
Browse files Browse the repository at this point in the history
切换PDF预览为gradio-pdf。
  • Loading branch information
Byaidu authored Dec 13, 2024
2 parents 9cb812e + da67886 commit 8e8cbe2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pdf2zh/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
)

import gradio as gr
from gradio_pdf import PDF
import numpy as np
import pymupdf
import tqdm
Expand Down Expand Up @@ -88,7 +89,7 @@ def pdf_preview(file):

def upload_file(file, service, progress=gr.Progress()):
preview_image = pdf_preview(file)
return file, preview_image
return file, file


def download_with_limit(url, save_path, size_limit):
Expand Down Expand Up @@ -189,7 +190,7 @@ def progress_bar(t: tqdm.tqdm):

return (
str(file_mono),
translated_preview,
str(file_mono),
str(file_dual),
gr.update(visible=True),
gr.update(visible=True),
Expand Down Expand Up @@ -380,7 +381,7 @@ def on_select_filetype(file_type):

with gr.Column(scale=2):
gr.Markdown("## Preview")
preview = gr.Image(label="Document Preview", visible=True)
preview = PDF(label="Document Preview", visible=True)

# Event handlers
file_input.upload(
Expand Down

0 comments on commit 8e8cbe2

Please sign in to comment.