| import gradio as gr | |
| from PIL import Image | |
| from pix2tex.cli import LatexOCR | |
| def predict(img: Image.Image) -> str: | |
| global model | |
| return model(img) | |
| model = LatexOCR() | |
| iface = gr.Interface(fn=predict, inputs=gr.Image(type='pil'), outputs="text") | |
| iface.launch() |