Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -443,7 +443,7 @@ else:
|
|
| 443 |
print(f"Took {time.time() - start_time} seconds to analyze {totalFiles} files!")
|
| 444 |
st.success(f"Took {time.time() - start_time} seconds to analyze {totalFiles} files!")
|
| 445 |
|
| 446 |
-
st.write(st.__version__)
|
| 447 |
c1,c2,c3 = st.columns(3)
|
| 448 |
with c1:
|
| 449 |
st.write("Left")
|
|
@@ -480,8 +480,8 @@ with t1:
|
|
| 480 |
f,
|
| 481 |
'sonogram-test2.txt',
|
| 482 |
key='download-txt2',
|
| 483 |
-
on_click="ignore"
|
| 484 |
-
|
| 485 |
|
| 486 |
currFile = st.sidebar.selectbox('Current File', file_names,on_change=updateMultiSelect,key="select_currFile")
|
| 487 |
|
|
@@ -556,9 +556,11 @@ try:
|
|
| 556 |
'sonogram-analysis-'+currPlainName+'.csv',
|
| 557 |
"text/csv",
|
| 558 |
key='download-csv',
|
|
|
|
| 559 |
)
|
| 560 |
st.dataframe(currDF)
|
| 561 |
with pie1:
|
|
|
|
| 562 |
df3 = st.session_state.summaries[currFileIndex]["df3"]
|
| 563 |
fig1 = go.Figure()
|
| 564 |
fig1.update_layout(
|
|
@@ -567,11 +569,14 @@ try:
|
|
| 567 |
plot_bgcolor='rgba(0, 0, 0, 0)',
|
| 568 |
paper_bgcolor='rgba(0, 0, 0, 0)',
|
| 569 |
)
|
|
|
|
| 570 |
fig1.add_trace(go.Pie(values=df3["values"],labels=df3["names"],sort=False))
|
|
|
|
| 571 |
|
| 572 |
col1_1, col1_2 = st.columns(2)
|
| 573 |
fig1.write_image("ascn_pie1.pdf")
|
| 574 |
fig1.write_image("ascn_pie1.svg")
|
|
|
|
| 575 |
with col1_1:
|
| 576 |
with open('ascn_pie1.pdf') as f:
|
| 577 |
st.download_button(
|
|
@@ -579,7 +584,9 @@ try:
|
|
| 579 |
f,
|
| 580 |
'sonogram-voice-category-'+currPlainName+'.pdf',
|
| 581 |
key='download-pdf1',
|
|
|
|
| 582 |
)
|
|
|
|
| 583 |
with col1_2:
|
| 584 |
with open('ascn_pie1.svg') as f:
|
| 585 |
st.download_button(
|
|
@@ -587,8 +594,11 @@ try:
|
|
| 587 |
f,
|
| 588 |
'sonogram-voice-category-'+currPlainName+'.svg',
|
| 589 |
key='download-svg1',
|
|
|
|
| 590 |
)
|
|
|
|
| 591 |
st.plotly_chart(fig1, use_container_width=True)
|
|
|
|
| 592 |
|
| 593 |
with pie2:
|
| 594 |
df4 = st.session_state.summaries[currFileIndex]["df4"]
|
|
@@ -617,6 +627,7 @@ try:
|
|
| 617 |
f,
|
| 618 |
'sonogram-speaker-percent-'+currPlainName+'.pdf',
|
| 619 |
key='download-pdf2',
|
|
|
|
| 620 |
)
|
| 621 |
with col2_2:
|
| 622 |
with open('ascn_pie2.svg') as f:
|
|
@@ -625,6 +636,7 @@ try:
|
|
| 625 |
f,
|
| 626 |
'sonogram-speaker-percent-'+currPlainName+'.svg',
|
| 627 |
key='download-svg2',
|
|
|
|
| 628 |
)
|
| 629 |
st.plotly_chart(fig2, use_container_width=True)
|
| 630 |
|
|
@@ -665,6 +677,7 @@ try:
|
|
| 665 |
f,
|
| 666 |
'sonogram-speaker-categories-'+currPlainName+'.pdf',
|
| 667 |
key='download-pdf3',
|
|
|
|
| 668 |
)
|
| 669 |
with col3_2:
|
| 670 |
with open('ascn_sunburst.svg') as f:
|
|
@@ -673,6 +686,7 @@ try:
|
|
| 673 |
f,
|
| 674 |
'sonogram-speaker-categories-'+currPlainName+'.svg',
|
| 675 |
key='download-svg3',
|
|
|
|
| 676 |
)
|
| 677 |
st.plotly_chart(fig3_1, use_container_width=True)
|
| 678 |
|
|
@@ -713,6 +727,7 @@ try:
|
|
| 713 |
f,
|
| 714 |
'sonogram-treemap-'+currPlainName+'.pdf',
|
| 715 |
key='download-pdf4',
|
|
|
|
| 716 |
)
|
| 717 |
with col4_2:
|
| 718 |
with open('ascn_treemap.svg') as f:
|
|
@@ -721,6 +736,7 @@ try:
|
|
| 721 |
f,
|
| 722 |
'sonogram-treemap-'+currPlainName+'.svg',
|
| 723 |
key='download-svg4',
|
|
|
|
| 724 |
)
|
| 725 |
st.plotly_chart(fig3, use_container_width=True)
|
| 726 |
|
|
@@ -763,6 +779,7 @@ try:
|
|
| 763 |
f,
|
| 764 |
'sonogram-timeline-'+currPlainName+'.pdf',
|
| 765 |
key='download-pdf5',
|
|
|
|
| 766 |
)
|
| 767 |
with col5_2:
|
| 768 |
with open('ascn_timeline.svg') as f:
|
|
@@ -771,6 +788,7 @@ try:
|
|
| 771 |
f,
|
| 772 |
'sonogram-timeline-'+currPlainName+'.svg',
|
| 773 |
key='download-svg5',
|
|
|
|
| 774 |
)
|
| 775 |
st.plotly_chart(fig_la, use_container_width=True)
|
| 776 |
|
|
@@ -806,6 +824,7 @@ try:
|
|
| 806 |
f,
|
| 807 |
'sonogram-speaker-time-'+currPlainName+'.pdf',
|
| 808 |
key='download-pdf6',
|
|
|
|
| 809 |
)
|
| 810 |
with col6_2:
|
| 811 |
with open('ascn_bar.svg') as f:
|
|
@@ -814,6 +833,7 @@ try:
|
|
| 814 |
f,
|
| 815 |
'sonogram-speaker-time-'+currPlainName+'.svg',
|
| 816 |
key='download-svg6',
|
|
|
|
| 817 |
)
|
| 818 |
st.plotly_chart(fig2_la, use_container_width=True)
|
| 819 |
|
|
|
|
| 443 |
print(f"Took {time.time() - start_time} seconds to analyze {totalFiles} files!")
|
| 444 |
st.success(f"Took {time.time() - start_time} seconds to analyze {totalFiles} files!")
|
| 445 |
|
| 446 |
+
'''st.write(st.__version__)
|
| 447 |
c1,c2,c3 = st.columns(3)
|
| 448 |
with c1:
|
| 449 |
st.write("Left")
|
|
|
|
| 480 |
f,
|
| 481 |
'sonogram-test2.txt',
|
| 482 |
key='download-txt2',
|
| 483 |
+
on_click="ignore",
|
| 484 |
+
)'''
|
| 485 |
|
| 486 |
currFile = st.sidebar.selectbox('Current File', file_names,on_change=updateMultiSelect,key="select_currFile")
|
| 487 |
|
|
|
|
| 556 |
'sonogram-analysis-'+currPlainName+'.csv',
|
| 557 |
"text/csv",
|
| 558 |
key='download-csv',
|
| 559 |
+
on_click="ignore",
|
| 560 |
)
|
| 561 |
st.dataframe(currDF)
|
| 562 |
with pie1:
|
| 563 |
+
printV("In Pie1",4)
|
| 564 |
df3 = st.session_state.summaries[currFileIndex]["df3"]
|
| 565 |
fig1 = go.Figure()
|
| 566 |
fig1.update_layout(
|
|
|
|
| 569 |
plot_bgcolor='rgba(0, 0, 0, 0)',
|
| 570 |
paper_bgcolor='rgba(0, 0, 0, 0)',
|
| 571 |
)
|
| 572 |
+
printV("Pie1 Pretrace",4)
|
| 573 |
fig1.add_trace(go.Pie(values=df3["values"],labels=df3["names"],sort=False))
|
| 574 |
+
printV("Pie1 Posttrace",4)
|
| 575 |
|
| 576 |
col1_1, col1_2 = st.columns(2)
|
| 577 |
fig1.write_image("ascn_pie1.pdf")
|
| 578 |
fig1.write_image("ascn_pie1.svg")
|
| 579 |
+
printV("Pie1 files written",4)
|
| 580 |
with col1_1:
|
| 581 |
with open('ascn_pie1.pdf') as f:
|
| 582 |
st.download_button(
|
|
|
|
| 584 |
f,
|
| 585 |
'sonogram-voice-category-'+currPlainName+'.pdf',
|
| 586 |
key='download-pdf1',
|
| 587 |
+
on_click="ignore",
|
| 588 |
)
|
| 589 |
+
printV("Pie1 in col1_1",4)
|
| 590 |
with col1_2:
|
| 591 |
with open('ascn_pie1.svg') as f:
|
| 592 |
st.download_button(
|
|
|
|
| 594 |
f,
|
| 595 |
'sonogram-voice-category-'+currPlainName+'.svg',
|
| 596 |
key='download-svg1',
|
| 597 |
+
on_click="ignore",
|
| 598 |
)
|
| 599 |
+
printV("Pie1 in col1_2",4)
|
| 600 |
st.plotly_chart(fig1, use_container_width=True)
|
| 601 |
+
printV("Pie1 post plotly",4)
|
| 602 |
|
| 603 |
with pie2:
|
| 604 |
df4 = st.session_state.summaries[currFileIndex]["df4"]
|
|
|
|
| 627 |
f,
|
| 628 |
'sonogram-speaker-percent-'+currPlainName+'.pdf',
|
| 629 |
key='download-pdf2',
|
| 630 |
+
on_click="ignore",
|
| 631 |
)
|
| 632 |
with col2_2:
|
| 633 |
with open('ascn_pie2.svg') as f:
|
|
|
|
| 636 |
f,
|
| 637 |
'sonogram-speaker-percent-'+currPlainName+'.svg',
|
| 638 |
key='download-svg2',
|
| 639 |
+
on_click="ignore",
|
| 640 |
)
|
| 641 |
st.plotly_chart(fig2, use_container_width=True)
|
| 642 |
|
|
|
|
| 677 |
f,
|
| 678 |
'sonogram-speaker-categories-'+currPlainName+'.pdf',
|
| 679 |
key='download-pdf3',
|
| 680 |
+
on_click="ignore",
|
| 681 |
)
|
| 682 |
with col3_2:
|
| 683 |
with open('ascn_sunburst.svg') as f:
|
|
|
|
| 686 |
f,
|
| 687 |
'sonogram-speaker-categories-'+currPlainName+'.svg',
|
| 688 |
key='download-svg3',
|
| 689 |
+
on_click="ignore",
|
| 690 |
)
|
| 691 |
st.plotly_chart(fig3_1, use_container_width=True)
|
| 692 |
|
|
|
|
| 727 |
f,
|
| 728 |
'sonogram-treemap-'+currPlainName+'.pdf',
|
| 729 |
key='download-pdf4',
|
| 730 |
+
on_click="ignore",
|
| 731 |
)
|
| 732 |
with col4_2:
|
| 733 |
with open('ascn_treemap.svg') as f:
|
|
|
|
| 736 |
f,
|
| 737 |
'sonogram-treemap-'+currPlainName+'.svg',
|
| 738 |
key='download-svg4',
|
| 739 |
+
on_click="ignore",
|
| 740 |
)
|
| 741 |
st.plotly_chart(fig3, use_container_width=True)
|
| 742 |
|
|
|
|
| 779 |
f,
|
| 780 |
'sonogram-timeline-'+currPlainName+'.pdf',
|
| 781 |
key='download-pdf5',
|
| 782 |
+
on_click="ignore",
|
| 783 |
)
|
| 784 |
with col5_2:
|
| 785 |
with open('ascn_timeline.svg') as f:
|
|
|
|
| 788 |
f,
|
| 789 |
'sonogram-timeline-'+currPlainName+'.svg',
|
| 790 |
key='download-svg5',
|
| 791 |
+
on_click="ignore",
|
| 792 |
)
|
| 793 |
st.plotly_chart(fig_la, use_container_width=True)
|
| 794 |
|
|
|
|
| 824 |
f,
|
| 825 |
'sonogram-speaker-time-'+currPlainName+'.pdf',
|
| 826 |
key='download-pdf6',
|
| 827 |
+
on_click="ignore",
|
| 828 |
)
|
| 829 |
with col6_2:
|
| 830 |
with open('ascn_bar.svg') as f:
|
|
|
|
| 833 |
f,
|
| 834 |
'sonogram-speaker-time-'+currPlainName+'.svg',
|
| 835 |
key='download-svg6',
|
| 836 |
+
on_click="ignore",
|
| 837 |
)
|
| 838 |
st.plotly_chart(fig2_la, use_container_width=True)
|
| 839 |
|