Ajaykanth Maddi commited on
Commit ·
f040c98
1
Parent(s): aa531e0
Export Button UI Changes
Browse files
app.py
CHANGED
|
@@ -349,6 +349,7 @@ def run_rag_pipeline(subset, question, custom_question, chunking, embed_model, r
|
|
| 349 |
json.dumps(y_pred_metrics, indent=2),
|
| 350 |
formatted_chunks,
|
| 351 |
json.loads(evaluator_json_output) if evaluator_json_output else {"error": "No evaluation result available."},
|
|
|
|
| 352 |
)
|
| 353 |
|
| 354 |
|
|
@@ -428,6 +429,14 @@ with gr.Blocks(
|
|
| 428 |
subset_dropdown.change(fn=update_question_list_and_info, inputs=[subset_dropdown], outputs=[question_dropdown, orig_ans_display, y_metrics_display])
|
| 429 |
question_dropdown.change(fn=get_info_from_sample_questions, inputs=[subset_dropdown, question_dropdown], outputs=[orig_ans_display, y_metrics_display])
|
| 430 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 431 |
submit_btn.click(
|
| 432 |
fn=run_rag_pipeline,
|
| 433 |
inputs=[
|
|
@@ -436,29 +445,43 @@ with gr.Blocks(
|
|
| 436 |
chunk_count, retriever_type,
|
| 437 |
reranking_checkbox, evaluator_dropdown
|
| 438 |
],
|
| 439 |
-
outputs=[gen_ans_display, y_pred_metrics_display, chunks_retrieved_display, evaluator_json_output]
|
| 440 |
)
|
| 441 |
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 462 |
|
| 463 |
|
| 464 |
demo.launch(debug=True, prevent_thread_lock=True, share=True)
|
|
|
|
| 349 |
json.dumps(y_pred_metrics, indent=2),
|
| 350 |
formatted_chunks,
|
| 351 |
json.loads(evaluator_json_output) if evaluator_json_output else {"error": "No evaluation result available."},
|
| 352 |
+
{}
|
| 353 |
)
|
| 354 |
|
| 355 |
|
|
|
|
| 429 |
subset_dropdown.change(fn=update_question_list_and_info, inputs=[subset_dropdown], outputs=[question_dropdown, orig_ans_display, y_metrics_display])
|
| 430 |
question_dropdown.change(fn=get_info_from_sample_questions, inputs=[subset_dropdown, question_dropdown], outputs=[orig_ans_display, y_metrics_display])
|
| 431 |
|
| 432 |
+
with gr.Row():
|
| 433 |
+
# Add export button
|
| 434 |
+
# gr.Interface(fn=generate_file, inputs=orig_ans_display, outputs="file")
|
| 435 |
+
generate_btn = gr.Button("Generate JSON & Download")
|
| 436 |
+
with gr.Column(scale=2):
|
| 437 |
+
json_output = gr.Code(label="JSON Output", language="json")
|
| 438 |
+
download_file = gr.File(label="Download Link")
|
| 439 |
+
|
| 440 |
submit_btn.click(
|
| 441 |
fn=run_rag_pipeline,
|
| 442 |
inputs=[
|
|
|
|
| 445 |
chunk_count, retriever_type,
|
| 446 |
reranking_checkbox, evaluator_dropdown
|
| 447 |
],
|
| 448 |
+
outputs=[gen_ans_display, y_pred_metrics_display, chunks_retrieved_display, evaluator_json_output, download_file]
|
| 449 |
)
|
| 450 |
|
| 451 |
+
generate_btn.click(
|
| 452 |
+
fn=generate_file,
|
| 453 |
+
inputs=[subset_dropdown, dataset_type_dropdown,
|
| 454 |
+
chunking_dropdown, embed_dropdown, retriever_dropdown,
|
| 455 |
+
chunk_count, retriever_type,
|
| 456 |
+
reranking_checkbox, evaluator_dropdown,
|
| 457 |
+
orig_ans_display, y_metrics_display,
|
| 458 |
+
gen_ans_display, y_pred_metrics_display,
|
| 459 |
+
chunks_retrieved_display,
|
| 460 |
+
evaluator_json_output
|
| 461 |
+
],
|
| 462 |
+
outputs=[json_output, download_file]
|
| 463 |
+
)
|
| 464 |
+
|
| 465 |
+
# with gr.Row():
|
| 466 |
+
# # Add export button
|
| 467 |
+
# # gr.Interface(fn=generate_file, inputs=orig_ans_display, outputs="file")
|
| 468 |
+
# generate_btn = gr.Button("Generate JSON & Download")
|
| 469 |
+
# with gr.Column(scale=2):
|
| 470 |
+
# json_output = gr.Code(label="JSON Output", language="json")
|
| 471 |
+
# download_file = gr.File(label="Download Link")
|
| 472 |
+
# generate_btn.click(
|
| 473 |
+
# fn=generate_file,
|
| 474 |
+
# inputs=[subset_dropdown, dataset_type_dropdown,
|
| 475 |
+
# chunking_dropdown, embed_dropdown, retriever_dropdown,
|
| 476 |
+
# chunk_count, retriever_type,
|
| 477 |
+
# reranking_checkbox, evaluator_dropdown,
|
| 478 |
+
# orig_ans_display, y_metrics_display,
|
| 479 |
+
# gen_ans_display, y_pred_metrics_display,
|
| 480 |
+
# chunks_retrieved_display,
|
| 481 |
+
# evaluator_json_output
|
| 482 |
+
# ],
|
| 483 |
+
# outputs=[json_output, download_file]
|
| 484 |
+
# )
|
| 485 |
|
| 486 |
|
| 487 |
demo.launch(debug=True, prevent_thread_lock=True, share=True)
|