Rick7799 commited on
Commit
8c018f3
1 Parent(s): bf2bba9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,12 +1,13 @@
1
  import gradio as gr
2
- from byaldi import RAGMultiModalModel # Importing the ColPali model
3
 
4
  # Initialize the ColPali model
5
  model = RAGMultiModalModel.from_pretrained("vidore/colpali-v1.2")
6
 
7
  def extract_and_search(image, keyword):
8
  # Use the model to extract text from the image
9
- extracted_text = model.predict(image) # Replace with actual prediction method
 
10
 
11
  # Perform keyword search
12
  matching_lines = [line for line in extracted_text.splitlines() if keyword.lower() in line.lower()]
@@ -29,4 +30,4 @@ interface = gr.Interface(
29
  )
30
 
31
  # Launch the app
32
- interface.launch(share=True)
 
1
  import gradio as gr
2
+ from transformers import RAGMultiModalModel # Importing the ColPali model
3
 
4
  # Initialize the ColPali model
5
  model = RAGMultiModalModel.from_pretrained("vidore/colpali-v1.2")
6
 
7
  def extract_and_search(image, keyword):
8
  # Use the model to extract text from the image
9
+ inputs = {"images": [image]}
10
+ extracted_text = model.generate(**inputs) # Replace with actual prediction method
11
 
12
  # Perform keyword search
13
  matching_lines = [line for line in extracted_text.splitlines() if keyword.lower() in line.lower()]
 
30
  )
31
 
32
  # Launch the app
33
+ interface.launch(share=True)