Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,24 +35,25 @@ def get_latex_from_image_all_formats(image):
|
|
| 35 |
|
| 36 |
return formats_results
|
| 37 |
|
| 38 |
-
|
| 39 |
def build_gradio_app():
|
| 40 |
-
with gr.Blocks() as
|
| 41 |
with gr.Row():
|
| 42 |
image_input = gr.Image(type="pil", label="์ด๋ฏธ์ง ์
๋ก๋")
|
| 43 |
submit_button = gr.Button("๋ณํํ๊ธฐ")
|
| 44 |
-
|
| 45 |
outputs = [gr.Textbox(label=f"{f} ๊ฒฐ๊ณผ") for f in ["text", "latex_styled", "latex_normal", "latex_list", "latex_simplified", "asciimath", "mathml"]]
|
| 46 |
|
|
|
|
|
|
|
| 47 |
def process_and_output(image):
|
| 48 |
-
|
| 49 |
-
return [
|
| 50 |
|
| 51 |
submit_button.click(fn=process_and_output, inputs=image_input, outputs=outputs)
|
| 52 |
|
| 53 |
-
return
|
| 54 |
|
| 55 |
-
# Gradio ์ฑ ์คํ
|
| 56 |
if __name__ == "__main__":
|
| 57 |
app = build_gradio_app()
|
| 58 |
-
app.launch()
|
|
|
|
| 35 |
|
| 36 |
return formats_results
|
| 37 |
|
| 38 |
+
|
| 39 |
def build_gradio_app():
|
| 40 |
+
with gr.Blocks() as demo:
|
| 41 |
with gr.Row():
|
| 42 |
image_input = gr.Image(type="pil", label="์ด๋ฏธ์ง ์
๋ก๋")
|
| 43 |
submit_button = gr.Button("๋ณํํ๊ธฐ")
|
| 44 |
+
|
| 45 |
outputs = [gr.Textbox(label=f"{f} ๊ฒฐ๊ณผ") for f in ["text", "latex_styled", "latex_normal", "latex_list", "latex_simplified", "asciimath", "mathml"]]
|
| 46 |
|
| 47 |
+
latex_iframe = gr.HTML(value='<iframe src="https://latex.js.org/playground.html" style="width: 100%; height: 700px; border: 2px solid #007bff; border-radius: 8px;"></iframe>', elem_id="latex_iframe")
|
| 48 |
+
|
| 49 |
def process_and_output(image):
|
| 50 |
+
latex_result = get_latex_from_image_all_formats(image) # ๋ณ์๋ช
์์
|
| 51 |
+
return [latex_result.get(f) for f in ["text", "latex_styled", "latex_normal", "latex_list", "latex_simplified", "asciimath", "mathml"]] # ์์ ๋ ๋ถ๋ถ
|
| 52 |
|
| 53 |
submit_button.click(fn=process_and_output, inputs=image_input, outputs=outputs)
|
| 54 |
|
| 55 |
+
return demo
|
| 56 |
|
|
|
|
| 57 |
if __name__ == "__main__":
|
| 58 |
app = build_gradio_app()
|
| 59 |
+
app.launch()
|