Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -40,29 +40,32 @@ def get_latex_from_image_all_formats(image):
|
|
40 |
result = response.json()
|
41 |
# formats_results ๋ณ์๋ ์ฌ์ฉํ์ง ์์ผ๋ฏ๋ก ์ ๊ฑฐํ์ฌ ์ฝ๋๋ฅผ ๋จ์ํ
|
42 |
return result
|
|
|
43 |
|
44 |
def build_gradio_app(css=css):
|
45 |
-
with gr.Blocks() as demo:
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
|
|
49 |
|
50 |
-
# ๋จ์ผ ์ถ๋ ฅ์ ์ํด outputs ๋ถ๋ถ์ ๋จ์ํ
|
51 |
outputs = gr.Textbox(label="๊ฒฐ๊ณผ")
|
52 |
-
latex_iframe = gr.HTML(value='<iframe src="https://www.mathjax.org/#demo" style="width: 100%; height: 700px; border: 2px solid #007bff; border-radius: 8px;"></iframe>', elem_id="latex_iframe")
|
53 |
-
|
54 |
-
# ์์ ์ด๋ฏธ์ง๋ฅผ ์
๋ ฅ์ผ๋ก ํ๋ Examples ์ปดํฌ๋ํธ ์ถ๊ฐ
|
55 |
-
examples = gr.Examples(examples=[["ko.png"], ["en.png"]], inputs=image_input, fn=process_and_output, outputs=outputs)
|
56 |
|
57 |
def process_and_output(image):
|
58 |
latex_result = get_latex_from_image_all_formats(image)
|
59 |
text_result = latex_result.get("text", "No result")
|
60 |
return text_result
|
|
|
|
|
|
|
61 |
|
62 |
submit_button.click(fn=process_and_output, inputs=image_input, outputs=outputs)
|
|
|
|
|
63 |
|
64 |
return demo
|
65 |
|
66 |
if __name__ == "__main__":
|
67 |
app = build_gradio_app()
|
68 |
-
app.launch()
|
|
|
40 |
result = response.json()
|
41 |
# formats_results ๋ณ์๋ ์ฌ์ฉํ์ง ์์ผ๋ฏ๋ก ์ ๊ฑฐํ์ฌ ์ฝ๋๋ฅผ ๋จ์ํ
|
42 |
return result
|
43 |
+
|
44 |
|
45 |
def build_gradio_app(css=css):
|
46 |
+
with gr.Blocks(css=css) as demo:
|
47 |
+
gr.Markdown("# ArXivGPT LaTeX Tool")
|
48 |
+
gr.Markdown("This comprehensive solution encompasses an automated workflow...")
|
49 |
+
|
50 |
+
image_input = gr.Image(type="pil", label="์ด๋ฏธ์ง ์
๋ก๋")
|
51 |
+
submit_button = gr.Button("๋ณํํ๊ธฐ")
|
52 |
|
|
|
53 |
outputs = gr.Textbox(label="๊ฒฐ๊ณผ")
|
|
|
|
|
|
|
|
|
54 |
|
55 |
def process_and_output(image):
|
56 |
latex_result = get_latex_from_image_all_formats(image)
|
57 |
text_result = latex_result.get("text", "No result")
|
58 |
return text_result
|
59 |
+
|
60 |
+
# Examples ์ ์๋ฅผ process_and_output ํจ์ ์ ์ ํ๋ก ์ฎ๊น๋๋ค.
|
61 |
+
examples = gr.Examples(examples=[["ko.png"], ["en.png"], ["hand.jpg"]], inputs=image_input, outputs=outputs, fn=process_and_output)
|
62 |
|
63 |
submit_button.click(fn=process_and_output, inputs=image_input, outputs=outputs)
|
64 |
+
|
65 |
+
demo.add(examples) # gr.Blocks์ examples ์ปดํฌ๋ํธ๋ฅผ ์ถ๊ฐํฉ๋๋ค.
|
66 |
|
67 |
return demo
|
68 |
|
69 |
if __name__ == "__main__":
|
70 |
app = build_gradio_app()
|
71 |
+
app.launch()
|