Swekerr commited on
Commit
14aca25
·
verified ·
1 Parent(s): 235fb7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -17,13 +17,10 @@ def load_models():
17
  RAG, model, processor = load_models()
18
 
19
  # Function for OCR and search
 
20
  def ocr_and_search(image, keyword):
21
  # Hardcoded query to extract text in English, Sanskrit, and Hindi
22
  text_query = "Extract all the text in English, Sanskrit, and Hindi from the image."
23
- results = RAG.search(text_query, k=1)
24
-
25
- if not results: # Check if results are empty
26
- return "No results found for the given query.", [], "{}"
27
 
28
  # Prepare message for Qwen model
29
  messages = [
@@ -66,6 +63,7 @@ def ocr_and_search(image, keyword):
66
 
67
  return extracted_text, matched_sentences, json_output
68
 
 
69
  # Gradio App function
70
  def app(image, keyword):
71
  # Call OCR and search function
 
17
  RAG, model, processor = load_models()
18
 
19
  # Function for OCR and search
20
+ # Skip RAG search and use Qwen2VL for direct OCR
21
  def ocr_and_search(image, keyword):
22
  # Hardcoded query to extract text in English, Sanskrit, and Hindi
23
  text_query = "Extract all the text in English, Sanskrit, and Hindi from the image."
 
 
 
 
24
 
25
  # Prepare message for Qwen model
26
  messages = [
 
63
 
64
  return extracted_text, matched_sentences, json_output
65
 
66
+
67
  # Gradio App function
68
  def app(image, keyword):
69
  # Call OCR and search function