import gradio as gr import pytesseract import cv2 def process(image, lang): try: img = cv2.imread(image) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) threshold_img = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1] return pytesseract.image_to_string(threshold_img, lang=lang) 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 = """

Hello, thanks for coming, visit our tools: Genelify

""" ) interface.launch()