Spaces:
Running
Running
import gradio as gr | |
import pytesseract | |
import os | |
def process(image: str, lang: str = 'eng') -> str: | |
try: | |
result = pytesseract.image_to_string(image, lang=lang) | |
os.remove(image) | |
return result | |
except Exception as e: | |
return str(e) | |
langs = pytesseract.get_languages() | |
interface = gr.Interface( | |
process, | |
[gr.Image(type="filepath"), gr.Dropdown(label="Select Language", choices=langs, 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() |