Spaces:
Running
Running
File size: 1,095 Bytes
282ba81 6e98020 282ba81 6e98020 282ba81 ca60e9b 6e98020 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import gradio as gr
import requests
def latex_to_image(latex_code):
# Codecogs ์๋น์ค๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ
codecogs_url = "https://latex.codecogs.com/png.latex?"
# QuickLaTeX ์๋น์ค๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ (์ต์
)
quicklatex_url = "https://quicklatex.com/latex3.f"
# Codecogs ์๋น์ค๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ์ ๊ตฌํ
response_url = codecogs_url + requests.utils.quote(latex_code)
# QuickLaTeX ์๋น์ค๋ฅผ ์ฌ์ฉํ ๊ฒฝ์ฐ์ ๊ตฌํ (์ต์
, POST ์์ฒญ ํ์)
# response = requests.post(quicklatex_url, data={'formula': latex_code, 'fsize': '17px', 'fcolor': '000000'})
# if response.status_code == 200:
# response_url = response.text
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() |