AdrienB134 commited on
Commit
caf5c98
1 Parent(s): 35ee567
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -28,7 +28,7 @@ subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENT
28
 
29
  @spaces.GPU
30
  def model_inference(
31
- images, text, assistant_prefix= "Réfléchis step by step. Répond en faisant de belles phrases uniquement avec les informations du document fourni.", decoding_strategy = "Greedy", temperature= 0.4, max_new_tokens=512,
32
  repetition_penalty=1.2, top_p=0.8
33
  ):
34
  ## Load idefics
@@ -207,14 +207,20 @@ def get_example():
207
 
208
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
209
  gr.Markdown("# ColPali + Idefics3: Efficient Document Retrieval with Vision Language Models 📚")
 
 
 
 
 
210
 
211
  with gr.Row():
212
  with gr.Column(scale=2):
213
  gr.Markdown("## 1️⃣ Upload PDFs")
214
  file = gr.File(file_types=["pdf"], file_count="multiple", label="Upload PDFs")
215
 
216
- convert_button = gr.Button("🔄 Index documents")
217
  message = gr.Textbox("Files not yet uploaded", label="Status")
 
218
  embeds = gr.State(value=[])
219
  imgs = gr.State(value=[])
220
  img_chunk = gr.State(value=[])
@@ -223,15 +229,11 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
223
  gr.Markdown("## 2️⃣ Search")
224
  query = gr.Textbox(placeholder="Enter your query here", label="Query")
225
  k = gr.Slider(minimum=1, maximum=10, step=1, label="Number of results", value=5)
226
-
227
- with gr.Row():
228
- gr.Examples(
229
- examples=get_example(),
230
- inputs=[file, query],
231
- )
232
 
233
  # Define the actions
234
- search_button = gr.Button("🔍 Search", variant="primary")
235
  output_gallery = gr.Gallery(label="Retrieved Documents", height=600, show_label=True)
236
 
237
  convert_button.click(index, inputs=[file, embeds], outputs=[message, embeds, imgs])
 
28
 
29
  @spaces.GPU
30
  def model_inference(
31
+ images, text, assistant_prefix= "Réfléchis step by step. Répond uniquement avec les informations du document fourni.", decoding_strategy = "Greedy", temperature= 0.4, max_new_tokens=512,
32
  repetition_penalty=1.2, top_p=0.8
33
  ):
34
  ## Load idefics
 
207
 
208
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
209
  gr.Markdown("# ColPali + Idefics3: Efficient Document Retrieval with Vision Language Models 📚")
210
+ with gr.Row():
211
+ gr.Examples(
212
+ examples=get_example(),
213
+ inputs=[file, query],
214
+ )
215
 
216
  with gr.Row():
217
  with gr.Column(scale=2):
218
  gr.Markdown("## 1️⃣ Upload PDFs")
219
  file = gr.File(file_types=["pdf"], file_count="multiple", label="Upload PDFs")
220
 
221
+
222
  message = gr.Textbox("Files not yet uploaded", label="Status")
223
+ convert_button = gr.Button("🔄 Index documents")
224
  embeds = gr.State(value=[])
225
  imgs = gr.State(value=[])
226
  img_chunk = gr.State(value=[])
 
229
  gr.Markdown("## 2️⃣ Search")
230
  query = gr.Textbox(placeholder="Enter your query here", label="Query")
231
  k = gr.Slider(minimum=1, maximum=10, step=1, label="Number of results", value=5)
232
+ search_button = gr.Button("🔍 Search", variant="primary")
233
+
 
 
 
 
234
 
235
  # Define the actions
236
+
237
  output_gallery = gr.Gallery(label="Retrieved Documents", height=600, show_label=True)
238
 
239
  convert_button.click(index, inputs=[file, embeds], outputs=[message, embeds, imgs])