File size: 725 Bytes
2fe4a06
 
edf2be5
2fe4a06
 
 
edf2be5
 
 
2fe4a06
 
 
 
 
 
 
 
 
0599af6
2fe4a06
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
import pytesseract
import os

def process(image, lang):
    try:
        result = pytesseract.image_to_string(image, lang=lang)
        os.remove(image)
        return result
    except Exception as e:
        return str(e)

choices = pytesseract.get_languages()

interface = gr.Interface(
    process,
    [gr.Image(type="filepath"), gr.Dropdown(label="Select Language", choices=choices, type="value")],
    outputs="text",
    css="footer {visibility: hidden}",
    title="Optical Character Recognition | Image To Text",
    article = """<p style='text-align: center;'>Hello, thanks for coming, visit our tools: <a href="https://www.genelify.com" target="_blank">Genelify</a></p>"""
)
interface.launch()