AdrienB134 commited on
Commit
cc33a9b
1 Parent(s): 07df2cf
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -96,7 +96,10 @@ def index_gpu(images, ds):
96
  embeddings_doc = model(**batch_doc)
97
  ds.extend(list(torch.unbind(embeddings_doc.to("cpu"))))
98
  return f"Uploaded and converted {len(images)} pages", ds, images
99
-
 
 
 
100
 
101
  def get_example():
102
  return [[["climate_youth_magazine.pdf"], "How much tropical forest is cut annually ?"]]
@@ -133,7 +136,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
133
  search_button.click(search, inputs=[query, embeds, imgs, k], outputs=[output_gallery])
134
 
135
  answer_button = gr.Button("Answer", variant="primary")
136
- answer_button.click(answer, inputs=[])
137
 
138
  if __name__ == "__main__":
139
  demo.queue(max_size=10).launch(debug=True)
 
96
  embeddings_doc = model(**batch_doc)
97
  ds.extend(list(torch.unbind(embeddings_doc.to("cpu"))))
98
  return f"Uploaded and converted {len(images)} pages", ds, images
99
+
100
+ @spaces.GPU
101
+ def answer_gpu():
102
+ return 0
103
 
104
  def get_example():
105
  return [[["climate_youth_magazine.pdf"], "How much tropical forest is cut annually ?"]]
 
136
  search_button.click(search, inputs=[query, embeds, imgs, k], outputs=[output_gallery])
137
 
138
  answer_button = gr.Button("Answer", variant="primary")
139
+ answer_button.click(answer_gpu, inputs=[])
140
 
141
  if __name__ == "__main__":
142
  demo.queue(max_size=10).launch(debug=True)