Update app.py
Browse files
app.py
CHANGED
|
@@ -342,11 +342,11 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 342 |
submit_button = gr.Button(
|
| 343 |
"Submit", variant="primary", elem_id="submit-button"
|
| 344 |
)
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
|
| 351 |
for cb in [img_clear_button, clear_button]:
|
| 352 |
cb.click(
|
|
@@ -366,8 +366,8 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 366 |
outputs=[
|
| 367 |
image,
|
| 368 |
document,
|
| 369 |
-
|
| 370 |
-
|
| 371 |
img_clear_button,
|
| 372 |
example_image,
|
| 373 |
upload,
|
|
@@ -380,48 +380,36 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 380 |
upload.change(
|
| 381 |
fn=process_upload,
|
| 382 |
inputs=[upload],
|
| 383 |
-
outputs=[document, image, img_clear_button,
|
| 384 |
-
# output, output_text,
|
| 385 |
-
url_error],
|
| 386 |
)
|
| 387 |
submit.click(
|
| 388 |
fn=process_path,
|
| 389 |
inputs=[url],
|
| 390 |
-
outputs=[document, image, img_clear_button,
|
| 391 |
-
# output, output_text,
|
| 392 |
-
url_error],
|
| 393 |
)
|
| 394 |
|
| 395 |
question.submit(
|
| 396 |
fn=process_question,
|
| 397 |
inputs=[question, document, model],
|
| 398 |
-
outputs=[image,
|
| 399 |
-
# output, output_text
|
| 400 |
-
],
|
| 401 |
)
|
| 402 |
|
| 403 |
submit_button.click(
|
| 404 |
process_question,
|
| 405 |
inputs=[question, document, model],
|
| 406 |
-
outputs=[image,
|
| 407 |
-
# output, output_text
|
| 408 |
-
],
|
| 409 |
)
|
| 410 |
|
| 411 |
model.change(
|
| 412 |
process_question,
|
| 413 |
inputs=[question, document, model],
|
| 414 |
-
outputs=[image,
|
| 415 |
-
# output, output_text
|
| 416 |
-
],
|
| 417 |
)
|
| 418 |
|
| 419 |
example_image.change(
|
| 420 |
fn=load_example_document,
|
| 421 |
inputs=[example_image, example_question, model],
|
| 422 |
-
outputs=[document, question, image, img_clear_button,
|
| 423 |
-
# output, output_text
|
| 424 |
-
],
|
| 425 |
)
|
| 426 |
|
| 427 |
if __name__ == "__main__":
|
|
|
|
| 342 |
submit_button = gr.Button(
|
| 343 |
"Submit", variant="primary", elem_id="submit-button"
|
| 344 |
)
|
| 345 |
+
with gr.Column():
|
| 346 |
+
output_text = gr.Textbox(
|
| 347 |
+
label="Response", visible=False, elem_id="answer"
|
| 348 |
+
)
|
| 349 |
+
output = gr.JSON(label="Output", visible=False)
|
| 350 |
|
| 351 |
for cb in [img_clear_button, clear_button]:
|
| 352 |
cb.click(
|
|
|
|
| 366 |
outputs=[
|
| 367 |
image,
|
| 368 |
document,
|
| 369 |
+
output,
|
| 370 |
+
output_text,
|
| 371 |
img_clear_button,
|
| 372 |
example_image,
|
| 373 |
upload,
|
|
|
|
| 380 |
upload.change(
|
| 381 |
fn=process_upload,
|
| 382 |
inputs=[upload],
|
| 383 |
+
outputs=[document, image, img_clear_button, output, output_text, url_error],
|
|
|
|
|
|
|
| 384 |
)
|
| 385 |
submit.click(
|
| 386 |
fn=process_path,
|
| 387 |
inputs=[url],
|
| 388 |
+
outputs=[document, image, img_clear_button, output, output_text, url_error],
|
|
|
|
|
|
|
| 389 |
)
|
| 390 |
|
| 391 |
question.submit(
|
| 392 |
fn=process_question,
|
| 393 |
inputs=[question, document, model],
|
| 394 |
+
outputs=[image, output, output_text],
|
|
|
|
|
|
|
| 395 |
)
|
| 396 |
|
| 397 |
submit_button.click(
|
| 398 |
process_question,
|
| 399 |
inputs=[question, document, model],
|
| 400 |
+
outputs=[image, output, output_text],
|
|
|
|
|
|
|
| 401 |
)
|
| 402 |
|
| 403 |
model.change(
|
| 404 |
process_question,
|
| 405 |
inputs=[question, document, model],
|
| 406 |
+
outputs=[image, output, output_text],
|
|
|
|
|
|
|
| 407 |
)
|
| 408 |
|
| 409 |
example_image.change(
|
| 410 |
fn=load_example_document,
|
| 411 |
inputs=[example_image, example_question, model],
|
| 412 |
+
outputs=[document, question, image, img_clear_button, output, output_text],
|
|
|
|
|
|
|
| 413 |
)
|
| 414 |
|
| 415 |
if __name__ == "__main__":
|