Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
#
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
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:
|