vkapoor commited on
Commit
1540ae9
·
1 Parent(s): b7401f0

presentation

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -67,7 +67,7 @@ class PDFBrowser:
67
  self.current_page -= 1
68
  return self.render_page()
69
 
70
- def handle_click(self, _img, evt: SelectData):
71
  x_click, y_click = evt.index
72
  page = self.doc[self.current_page]
73
  pdf_w, pdf_h = page.rect.width, page.rect.height
@@ -75,7 +75,7 @@ class PDFBrowser:
75
  x_pdf = x_click/scale
76
  y_pdf = pdf_h - (y_click/scale)
77
  pt = fitz.Point(x_pdf, y_pdf)
78
- print(self.link_map.get(self.current_page))
79
  for rect, full in self.link_map.get(self.current_page, []):
80
  if rect.contains(pt):
81
  print(f"▶️ Selected video: {full}")
@@ -105,7 +105,7 @@ with gr.Blocks() as demo:
105
  # **IMPORTANT**: bind the image as an input here
106
  image_output.select(
107
  fn=pdfb.handle_click,
108
- inputs=[image_output], # <-- explicitly list your image
109
  outputs=[video_output] # <-- video_output will get updated
110
  )
111
 
 
67
  self.current_page -= 1
68
  return self.render_page()
69
 
70
+ def handle_click(self, evt: SelectData):
71
  x_click, y_click = evt.index
72
  page = self.doc[self.current_page]
73
  pdf_w, pdf_h = page.rect.width, page.rect.height
 
75
  x_pdf = x_click/scale
76
  y_pdf = pdf_h - (y_click/scale)
77
  pt = fitz.Point(x_pdf, y_pdf)
78
+ print(self.link_map.get(self.current_page), pt)
79
  for rect, full in self.link_map.get(self.current_page, []):
80
  if rect.contains(pt):
81
  print(f"▶️ Selected video: {full}")
 
105
  # **IMPORTANT**: bind the image as an input here
106
  image_output.select(
107
  fn=pdfb.handle_click,
108
+ inputs=None, # <-- explicitly list your image
109
  outputs=[video_output] # <-- video_output will get updated
110
  )
111