Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -84,14 +84,30 @@ def quiz_interface():
|
|
84 |
|
85 |
return interfaces
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
image = gr.Image()
|
88 |
output = gr.Textbox(label="Output")
|
|
|
89 |
|
90 |
ocr_app = gr.Interface(
|
91 |
-
generate_ocr,
|
92 |
-
image,
|
93 |
-
output,
|
94 |
title="Optical Character Recognition",
|
|
|
95 |
css=".gradio-container {background-color: lightgray} #radio_div {background-color: #FFD8B4; font-size: 40px;}"
|
96 |
)
|
97 |
|
@@ -102,3 +118,4 @@ quiz_app = gr.TabbedInterface(
|
|
102 |
)
|
103 |
|
104 |
quiz_app.launch()
|
|
|
|
84 |
|
85 |
return interfaces
|
86 |
|
87 |
+
# Explanation text
|
88 |
+
explanation_text = """
|
89 |
+
**Welcome to the OCR Tutorial!**
|
90 |
+
|
91 |
+
Optical Character Recognition (OCR) is a technology used to convert different types of documents, such as scanned paper documents, PDF files, or images captured by a digital camera, into editable and searchable data.
|
92 |
+
|
93 |
+
**Steps in the OCR Process:**
|
94 |
+
1. **Grayscale Conversion:** The first step in OCR is converting the image to grayscale. This simplifies the image and reduces the amount of data the OCR algorithm needs to process.
|
95 |
+
2. **Thresholding:** This step converts the grayscale image into a binary image, where the text is in black, and the background is in white. This makes it easier for the OCR algorithm to distinguish text from the background.
|
96 |
+
3. **OCR using EasyOCR:** We use the EasyOCR library to recognize and extract text from the preprocessed image.
|
97 |
+
|
98 |
+
Now that you understand the basics, you can try the OCR tool below and then proceed to answer the questions in the other tabs.
|
99 |
+
"""
|
100 |
+
|
101 |
image = gr.Image()
|
102 |
output = gr.Textbox(label="Output")
|
103 |
+
explanation = gr.Markdown(explanation_text)
|
104 |
|
105 |
ocr_app = gr.Interface(
|
106 |
+
fn=generate_ocr,
|
107 |
+
inputs=image,
|
108 |
+
outputs=output,
|
109 |
title="Optical Character Recognition",
|
110 |
+
description=explanation_text,
|
111 |
css=".gradio-container {background-color: lightgray} #radio_div {background-color: #FFD8B4; font-size: 40px;}"
|
112 |
)
|
113 |
|
|
|
118 |
)
|
119 |
|
120 |
quiz_app.launch()
|
121 |
+
|