Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -434,7 +434,10 @@ with tab3:
|
|
| 434 |
|
| 435 |
st.divider()
|
| 436 |
|
| 437 |
-
# Export
|
|
|
|
|
|
|
|
|
|
| 438 |
settings = {
|
| 439 |
"model": config.get("model"),
|
| 440 |
"temperature": config.get("temperature"),
|
|
@@ -442,22 +445,103 @@ with tab3:
|
|
| 442 |
"num_responses": config.get("num_responses")
|
| 443 |
}
|
| 444 |
|
| 445 |
-
csv_buffer = test_runner.export_to_csv(
|
| 446 |
-
st.session_state.rated_responses,
|
| 447 |
-
results,
|
| 448 |
-
settings
|
| 449 |
-
)
|
| 450 |
-
|
| 451 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 452 |
-
filename = f"prompt_ab_test_{timestamp}.csv"
|
| 453 |
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 461 |
|
| 462 |
# Tab 4: Logs
|
| 463 |
with tab4:
|
|
@@ -484,7 +568,7 @@ st.divider()
|
|
| 484 |
st.markdown(
|
| 485 |
"""
|
| 486 |
<div style='text-align: center; color: gray; font-size: 0.9em;'>
|
| 487 |
-
Prompt A/B Tester v2.0 | Created by Heuristica.pl - Marek Staniszewski
|
| 488 |
</div>
|
| 489 |
""",
|
| 490 |
unsafe_allow_html=True
|
|
|
|
| 434 |
|
| 435 |
st.divider()
|
| 436 |
|
| 437 |
+
# Export section
|
| 438 |
+
st.subheader("馃摜 Eksport Wynik贸w")
|
| 439 |
+
st.markdown("Pobierz wyniki w preferowanym formacie:")
|
| 440 |
+
|
| 441 |
settings = {
|
| 442 |
"model": config.get("model"),
|
| 443 |
"temperature": config.get("temperature"),
|
|
|
|
| 445 |
"num_responses": config.get("num_responses")
|
| 446 |
}
|
| 447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 448 |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
|
|
| 449 |
|
| 450 |
+
# Create 3 columns for export buttons
|
| 451 |
+
col1, col2, col3 = st.columns(3)
|
| 452 |
+
|
| 453 |
+
with col1:
|
| 454 |
+
# CSV Export
|
| 455 |
+
csv_buffer = test_runner.export_to_csv(
|
| 456 |
+
st.session_state.rated_responses,
|
| 457 |
+
results,
|
| 458 |
+
settings
|
| 459 |
+
)
|
| 460 |
+
st.download_button(
|
| 461 |
+
label="馃搫 CSV",
|
| 462 |
+
data=csv_buffer,
|
| 463 |
+
file_name=f"prompt_ab_test_{timestamp}.csv",
|
| 464 |
+
mime="text/csv",
|
| 465 |
+
use_container_width=True,
|
| 466 |
+
help="Pobierz w formacie CSV"
|
| 467 |
+
)
|
| 468 |
+
|
| 469 |
+
# JSON Export
|
| 470 |
+
json_buffer = test_runner.export_to_json(
|
| 471 |
+
st.session_state.rated_responses,
|
| 472 |
+
results,
|
| 473 |
+
settings
|
| 474 |
+
)
|
| 475 |
+
st.download_button(
|
| 476 |
+
label="馃敡 JSON",
|
| 477 |
+
data=json_buffer,
|
| 478 |
+
file_name=f"prompt_ab_test_{timestamp}.json",
|
| 479 |
+
mime="application/json",
|
| 480 |
+
use_container_width=True,
|
| 481 |
+
help="Pobierz w formacie JSON"
|
| 482 |
+
)
|
| 483 |
+
|
| 484 |
+
with col2:
|
| 485 |
+
# Excel Export
|
| 486 |
+
excel_buffer = test_runner.export_to_excel(
|
| 487 |
+
st.session_state.rated_responses,
|
| 488 |
+
results,
|
| 489 |
+
settings
|
| 490 |
+
)
|
| 491 |
+
st.download_button(
|
| 492 |
+
label="馃搳 Excel",
|
| 493 |
+
data=excel_buffer,
|
| 494 |
+
file_name=f"prompt_ab_test_{timestamp}.xlsx",
|
| 495 |
+
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
| 496 |
+
use_container_width=True,
|
| 497 |
+
help="Pobierz w formacie Excel"
|
| 498 |
+
)
|
| 499 |
+
|
| 500 |
+
# TXT Export
|
| 501 |
+
txt_buffer = test_runner.export_to_txt(
|
| 502 |
+
st.session_state.rated_responses,
|
| 503 |
+
results,
|
| 504 |
+
settings
|
| 505 |
+
)
|
| 506 |
+
st.download_button(
|
| 507 |
+
label="馃摑 TXT",
|
| 508 |
+
data=txt_buffer,
|
| 509 |
+
file_name=f"prompt_ab_test_{timestamp}.txt",
|
| 510 |
+
mime="text/plain",
|
| 511 |
+
use_container_width=True,
|
| 512 |
+
help="Pobierz w formacie TXT"
|
| 513 |
+
)
|
| 514 |
+
|
| 515 |
+
with col3:
|
| 516 |
+
# Markdown Export
|
| 517 |
+
markdown_buffer = test_runner.export_to_markdown(
|
| 518 |
+
st.session_state.rated_responses,
|
| 519 |
+
results,
|
| 520 |
+
settings
|
| 521 |
+
)
|
| 522 |
+
st.download_button(
|
| 523 |
+
label="馃搵 Markdown",
|
| 524 |
+
data=markdown_buffer,
|
| 525 |
+
file_name=f"prompt_ab_test_{timestamp}.md",
|
| 526 |
+
mime="text/markdown",
|
| 527 |
+
use_container_width=True,
|
| 528 |
+
help="Pobierz w formacie Markdown"
|
| 529 |
+
)
|
| 530 |
+
|
| 531 |
+
# Word Export
|
| 532 |
+
word_buffer = test_runner.export_to_word(
|
| 533 |
+
st.session_state.rated_responses,
|
| 534 |
+
results,
|
| 535 |
+
settings
|
| 536 |
+
)
|
| 537 |
+
st.download_button(
|
| 538 |
+
label="馃搫 Word",
|
| 539 |
+
data=word_buffer,
|
| 540 |
+
file_name=f"prompt_ab_test_{timestamp}.docx",
|
| 541 |
+
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
| 542 |
+
use_container_width=True,
|
| 543 |
+
help="Pobierz w formacie Word"
|
| 544 |
+
)
|
| 545 |
|
| 546 |
# Tab 4: Logs
|
| 547 |
with tab4:
|
|
|
|
| 568 |
st.markdown(
|
| 569 |
"""
|
| 570 |
<div style='text-align: center; color: gray; font-size: 0.9em;'>
|
| 571 |
+
Prompt A/B Tester v2.0 (Streamlit) | Created by Heuristica.pl - Marek Staniszewski
|
| 572 |
</div>
|
| 573 |
""",
|
| 574 |
unsafe_allow_html=True
|