seawolf2357 commited on
Commit
e04535c
·
verified ·
1 Parent(s): 6b7accd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -43,26 +43,25 @@ def get_latex_from_image_all_formats(image):
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
 
 
43
 
44
 
45
  def build_gradio_app(css=css):
46
+ demo = gr.Blocks(css=css)
47
+
48
+ with demo:
49
  gr.Markdown("# ArXivGPT LaTeX Tool")
50
+ gr.Markdown("This comprehensive solution...")
51
 
52
  image_input = gr.Image(type="pil", label="이미지 업로드")
53
  submit_button = gr.Button("변환하기")
54
 
55
+ output_text = gr.Textbox(label="결과")
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=output_text)
 
63
 
64
+ examples = gr.Examples(examples=[["ko.png"], ["en.png"], ["hand.jpg"]], inputs=image_input, fn=process_and_output, outputs=output_text, live=True)
 
 
65
 
66
  return demo
67