ocrlatex / app.py
seawolf2357's picture
Create app.py
282ba81 verified
raw
history blame
757 Bytes
import gradio as gr
def render_latex(latex_string):
preamble = """
<!DOCTYPE html>
<html>
<head>
<script src='https://polyfill.io/v3/polyfill.min.js?features=es6'></script>
<script id='MathJax-script' async src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'></script>
</head>
<body>
$$""" + latex_string + """$$
</body>
</html>
"""
return preamble
iface = gr.Interface(fn=render_latex,
inputs=gr.Textbox(lines=2, placeholder="Enter LaTeX String Here..."),
outputs="html",
title="LaTeX Renderer",
description="Enter a LaTeX string to render it!")
if __name__ == "__main__":
iface.launch(share=True)