Spaces:
Sleeping
Sleeping
fredcaixeta
commited on
Commit
·
b83e38c
1
Parent(s):
a5edea0
back to tabs
Browse files
app.py
CHANGED
|
@@ -23,22 +23,25 @@ def respond(message, history, user_id):
|
|
| 23 |
with gr.Blocks() as demo:
|
| 24 |
with gr.Tabs():
|
| 25 |
with gr.Tab("Text OCR Tesseract only"):
|
| 26 |
-
|
| 27 |
-
with gr.Column(scale=1, min_width=360):
|
| 28 |
img_in = gr.Image(label="Imagem (png, jpg, jpeg)", type="pil")
|
| 29 |
txt_out = gr.Textbox(label="Texto OCR", lines=12)
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
demo.launch()
|
|
|
|
| 23 |
with gr.Blocks() as demo:
|
| 24 |
with gr.Tabs():
|
| 25 |
with gr.Tab("Text OCR Tesseract only"):
|
| 26 |
+
with gr.Row():
|
|
|
|
| 27 |
img_in = gr.Image(label="Imagem (png, jpg, jpeg)", type="pil")
|
| 28 |
txt_out = gr.Textbox(label="Texto OCR", lines=12)
|
| 29 |
+
img_in.change(fn=ocr_tesseract_only, inputs=img_in, outputs=txt_out)
|
| 30 |
|
| 31 |
+
with gr.Tab("Chat"):
|
| 32 |
+
user_id = gr.State(str(uuid.uuid4()))
|
| 33 |
+
gr.ChatInterface(
|
| 34 |
+
fn=respond,
|
| 35 |
+
additional_inputs=[user_id],
|
| 36 |
+
type="messages",
|
| 37 |
+
title="Chat with AI Agent with Access to Extracted Data",
|
| 38 |
+
description="Envie perguntas sobre os dados extraídos.",
|
| 39 |
+
save_history=True,
|
| 40 |
+
examples=[
|
| 41 |
+
"What is the name of the invoice document available?",
|
| 42 |
+
"Which document has the ID aZwfUT2Zs?",
|
| 43 |
+
"How much is the Auto Previously Billed Premium?",
|
| 44 |
+
],
|
| 45 |
+
cache_examples=True,
|
| 46 |
+
)
|
| 47 |
demo.launch()
|