Update app.py
Browse files
app.py
CHANGED
|
@@ -550,9 +550,15 @@ with gr.Blocks(title="Camel-Doc-OCR") as demo:
|
|
| 550 |
|
| 551 |
gr.Markdown("Chọn mẫu prompt:")
|
| 552 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
| 553 |
for key in prompt_templates:
|
| 554 |
-
|
| 555 |
-
|
|
|
|
|
|
|
|
|
|
| 556 |
|
| 557 |
run_btn = gr.Button("Chạy OCR")
|
| 558 |
export_btn = gr.Button("Xuất JSON", visible=False)
|
|
@@ -579,4 +585,4 @@ with gr.Blocks(title="Camel-Doc-OCR") as demo:
|
|
| 579 |
export_btn.click(fn=lambda: gr.update(visible=True), outputs=[json_file])
|
| 580 |
|
| 581 |
if __name__ == "__main__":
|
| 582 |
-
demo.launch(
|
|
|
|
| 550 |
|
| 551 |
gr.Markdown("Chọn mẫu prompt:")
|
| 552 |
with gr.Row():
|
| 553 |
+
# for key in prompt_templates:
|
| 554 |
+
# btn = gr.Button(f"Mẫu {key}")
|
| 555 |
+
# btn.click(fn=insert_template, inputs=[gr.State(key)], outputs=config_input)
|
| 556 |
for key in prompt_templates:
|
| 557 |
+
gr.Button(f"Mẫu {key}").click(
|
| 558 |
+
fn=lambda k=key: insert_template(k),
|
| 559 |
+
outputs=config_input
|
| 560 |
+
)
|
| 561 |
+
|
| 562 |
|
| 563 |
run_btn = gr.Button("Chạy OCR")
|
| 564 |
export_btn = gr.Button("Xuất JSON", visible=False)
|
|
|
|
| 585 |
export_btn.click(fn=lambda: gr.update(visible=True), outputs=[json_file])
|
| 586 |
|
| 587 |
if __name__ == "__main__":
|
| 588 |
+
demo.launch()
|