seawolf2357 commited on
Commit
282ba81
·
verified ·
1 Parent(s): 6b9787f

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def render_latex(latex_string):
4
+ preamble = """
5
+ <!DOCTYPE html>
6
+ <html>
7
+ <head>
8
+ <script src='https://polyfill.io/v3/polyfill.min.js?features=es6'></script>
9
+ <script id='MathJax-script' async src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'></script>
10
+ </head>
11
+ <body>
12
+ $$""" + latex_string + """$$
13
+ </body>
14
+ </html>
15
+ """
16
+ return preamble
17
+
18
+ iface = gr.Interface(fn=render_latex,
19
+ inputs=gr.Textbox(lines=2, placeholder="Enter LaTeX String Here..."),
20
+ outputs="html",
21
+ title="LaTeX Renderer",
22
+ description="Enter a LaTeX string to render it!")
23
+
24
+ if __name__ == "__main__":
25
+ iface.launch(share=True)