ocrlatex / app.py
seawolf2357's picture
Update app.py
32eac0f verified
raw
history blame
808 Bytes
import gradio as gr
import requests
def latex_to_image(latex_code):
# 기본적인 LaTeX 문법 검사 예시
if not latex_code.startswith("\\"):
return "invalid equation: LaTeX commands should start with a backslash (\\)."
# 실제 렌더링 URL 생성 로직
codecogs_url = "https://latex.codecogs.com/png.latex?"
response_url = codecogs_url + requests.utils.quote(latex_code)
return response_url
iface = gr.Interface(fn=latex_to_image,
inputs=gr.Textbox(label="Enter your LaTeX code here"),
outputs=gr.Image(label="Rendered LaTeX"),
title="LaTeX to Image Converter",
description="This tool converts LaTeX code to an image using an external rendering service.")
iface.launch()