Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
import pytesseract
|
4 |
import re
|
5 |
|
6 |
-
#
|
|
|
|
|
|
|
7 |
def extract_text(image):
|
8 |
-
|
|
|
9 |
return extracted_text
|
10 |
|
11 |
# Step 2: Function to search and highlight the keyword in the extracted text
|
|
|
1 |
import gradio as gr
|
2 |
+
import easyocr
|
|
|
3 |
import re
|
4 |
|
5 |
+
# Initialize the EasyOCR reader for Hindi and English
|
6 |
+
reader = easyocr.Reader(['hi', 'en'])
|
7 |
+
|
8 |
+
# Step 1: Function to extract text using EasyOCR for both Hindi and English
|
9 |
def extract_text(image):
|
10 |
+
results = reader.readtext(image, detail=0) # 'detail=0' to get only the text output
|
11 |
+
extracted_text = " ".join(results) # Join all text results into a single string
|
12 |
return extracted_text
|
13 |
|
14 |
# Step 2: Function to search and highlight the keyword in the extracted text
|