gauri-sharan commited on
Commit
4fbbf94
·
verified ·
1 Parent(s): 1db9567

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -23,7 +23,7 @@ qwen_model = Qwen2VLForConditionalGeneration.from_pretrained(
23
  processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", trust_remote_code=True)
24
 
25
  # Function for OCR and text extraction
26
- @spaces.GPU(duration=120) # Increased GPU duration to 120 seconds
27
  def ocr_and_extract(image):
28
  try:
29
  # Save the uploaded image temporarily
@@ -85,6 +85,8 @@ def ocr_and_extract(image):
85
  traceback.print_exc()
86
  return f"Error: {error_message}"
87
 
 
 
88
  def search_keywords(extracted_text, keywords):
89
  if not extracted_text:
90
  return "No text extracted yet. Please upload an image."
 
23
  processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct", trust_remote_code=True)
24
 
25
  # Function for OCR and text extraction
26
+ # @spaces.GPU(duration=120) # Increased GPU duration to 120 seconds
27
  def ocr_and_extract(image):
28
  try:
29
  # Save the uploaded image temporarily
 
85
  traceback.print_exc()
86
  return f"Error: {error_message}"
87
 
88
+ ocr_and_extract = spaces.GPU(duration=120)(ocr_and_extract)
89
+
90
  def search_keywords(extracted_text, keywords):
91
  if not extracted_text:
92
  return "No text extracted yet. Please upload an image."