Vishwas1 commited on
Commit
f9c5f8b
·
verified ·
1 Parent(s): 5c27db2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -29,18 +29,18 @@ def perform_ocr_on_images(images):
29
  ocr_results.append(text)
30
  return "\n".join(ocr_results)
31
 
32
- def ocr_marathi_from_pdf(pdf_file):
33
  """
34
  Main function to handle Marathi OCR from a PDF file.
35
  """
36
- images = extract_images_from_pdf(pdf_file.name) # Use the file path from the upload
37
  ocr_text = perform_ocr_on_images(images)
38
  return ocr_text
39
 
40
  # Define the Gradio interface
41
  interface = gr.Interface(
42
  fn=ocr_marathi_from_pdf,
43
- inputs=gr.File(type="file", label="Upload Marathi PDF"),
44
  outputs=gr.Textbox(label="Extracted Marathi Text"),
45
  title="Marathi PDF OCR",
46
  description="Upload a PDF containing Marathi text. The app will extract the text using OCR.",
@@ -49,3 +49,4 @@ interface = gr.Interface(
49
  if __name__ == "__main__":
50
  interface.launch()
51
 
 
 
29
  ocr_results.append(text)
30
  return "\n".join(ocr_results)
31
 
32
+ def ocr_marathi_from_pdf(pdf_file_path):
33
  """
34
  Main function to handle Marathi OCR from a PDF file.
35
  """
36
+ images = extract_images_from_pdf(pdf_file_path) # Use the file path from the upload
37
  ocr_text = perform_ocr_on_images(images)
38
  return ocr_text
39
 
40
  # Define the Gradio interface
41
  interface = gr.Interface(
42
  fn=ocr_marathi_from_pdf,
43
+ inputs=gr.File(type="filepath", label="Upload Marathi PDF"), # Fixed the type here
44
  outputs=gr.Textbox(label="Extracted Marathi Text"),
45
  title="Marathi PDF OCR",
46
  description="Upload a PDF containing Marathi text. The app will extract the text using OCR.",
 
49
  if __name__ == "__main__":
50
  interface.launch()
51
 
52
+