Nikhil0987 commited on
Commit
7e4f369
·
verified ·
1 Parent(s): 971f411

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -64,14 +64,14 @@ def generate_response(history, query, btn):
64
  history[-1][-1] += char # Update the last response
65
  yield history, ''
66
 
67
- # # Function to render a specific page of a PDF file as an image
68
- # def render_file(file):
69
- # global N
70
- # doc = fitz.open(file.name)
71
- # page = doc[N]
72
- # pix = page.get_pixmap(matrix=fitz.Matrix(300/72, 300/72))
73
- # image = Image.frombytes('RGB', [pix.width, pix.height], pix.samples)
74
- # return image
75
 
76
  # # Gradio application setup
77
  # # with gr.Blocks() as demo:
 
64
  history[-1][-1] += char # Update the last response
65
  yield history, ''
66
 
67
+ # Function to render a specific page of a PDF file as an image
68
+ def render_file(file):
69
+ global N
70
+ doc = fitz.open(file.name)
71
+ page = doc[N]
72
+ pix = page.get_pixmap(matrix=fitz.Matrix(300/72, 300/72))
73
+ image = Image.frombytes('RGB', [pix.width, pix.height], pix.samples)
74
+ return image
75
 
76
  # # Gradio application setup
77
  # # with gr.Blocks() as demo: