czyoung commited on
Commit
3f63a03
·
verified ·
1 Parent(s): 27ee353

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +96 -84
app.py CHANGED
@@ -533,20 +533,22 @@ try:
533
  col1_1, col1_2 = st.columns(2)
534
  fig1.write_image("ascn_pie1.pdf")
535
  fig1.write_image("ascn_pie1.svg")
536
- with open('ascn_pie1.pdf') as f:
537
- col1_1.download_button(
538
- "Save As PDF",
539
- f,
540
- 'sonogram-voice-category-'+currPlainName+'.pdf',
541
- key='download-pdf1',
542
- )
543
- with open('ascn_pie1.svg') as f:
544
- col1_2.download_button(
545
- "Save As SVG",
546
- f,
547
- 'sonogram-voice-category-'+currPlainName+'.svg',
548
- key='download-svg1',
549
- )
 
 
550
  st.plotly_chart(fig1, use_container_width=True)
551
 
552
  with pie2:
@@ -569,20 +571,22 @@ try:
569
  col2_1, col2_2 = st.columns(2)
570
  fig2.write_image("ascn_pie2.pdf")
571
  fig2.write_image("ascn_pie2.svg")
572
- with open('ascn_pie2.pdf') as f:
573
- col2_1.download_button(
574
- "Save As PDF",
575
- f,
576
- 'sonogram-speaker-percent-'+currPlainName+'.pdf',
577
- key='download-pdf2',
578
- )
579
- with open('ascn_pie2.svg') as f:
580
- col2_2.download_button(
581
- "Save As SVG",
582
- f,
583
- 'sonogram-speaker-percent-'+currPlainName+'.svg',
584
- key='download-svg2',
585
- )
 
 
586
  st.plotly_chart(fig2, use_container_width=True)
587
 
588
  with sunburst1:
@@ -615,20 +619,22 @@ try:
615
  col3_1, col3_2 = st.columns(2)
616
  fig3_1.write_image("ascn_sunburst.pdf")
617
  fig3_1.write_image("ascn_sunburst.svg")
618
- with open('ascn_sunburst.pdf') as f:
619
- col3_1.download_button(
620
- "Save As PDF",
621
- f,
622
- 'sonogram-speaker-categories-'+currPlainName+'.pdf',
623
- key='download-pdf3',
624
- )
625
- with open('ascn_sunburst.svg') as f:
626
- col3_2.download_button(
627
- "Save As SVG",
628
- f,
629
- 'sonogram-speaker-categories-'+currPlainName+'.svg',
630
- key='download-svg3',
631
- )
 
 
632
  st.plotly_chart(fig3_1, use_container_width=True)
633
 
634
  with treemap1:
@@ -661,20 +667,22 @@ try:
661
  col4_1, col4_2 = st.columns(2)
662
  fig3.write_image("ascn_treemap.pdf")
663
  fig3.write_image("ascn_treemap.svg")
664
- with open('ascn_treemap.pdf') as f:
665
- col4_1.download_button(
666
- "Save As PDF",
667
- f,
668
- 'sonogram-treemap-'+currPlainName+'.pdf',
669
- key='download-pdf4',
670
- )
671
- with open('ascn_treemap.svg') as f:
672
- col4_2.download_button(
673
- "Save As SVG",
674
- f,
675
- 'sonogram-treemap-'+currPlainName+'.svg',
676
- key='download-svg4',
677
- )
 
 
678
  st.plotly_chart(fig3, use_container_width=True)
679
 
680
  # generate plotting window
@@ -709,20 +717,22 @@ try:
709
  col5_1, col5_2 = st.columns(2)
710
  fig_la.write_image("ascn_timeline.pdf")
711
  fig_la.write_image("ascn_timeline.svg")
712
- with open('ascn_timeline.pdf') as f:
713
- col5_1.download_button(
714
- "Save As PDF",
715
- f,
716
- 'sonogram-timeline-'+currPlainName+'.pdf',
717
- key='download-pdf5',
718
- )
719
- with open('ascn_timeline.svg') as f:
720
- col5_2.download_button(
721
- "Save As SVG",
722
- f,
723
- 'sonogram-timeline-'+currPlainName+'.svg',
724
- key='download-svg5',
725
- )
 
 
726
  st.plotly_chart(fig_la, use_container_width=True)
727
 
728
  with bar1:
@@ -750,20 +760,22 @@ try:
750
  col6_1, col6_2 = st.columns(2)
751
  fig_la.write_image("ascn_bar.pdf")
752
  fig_la.write_image("ascn_bar.svg")
753
- with open('ascn_bar.pdf') as f:
754
- col6_1.download_button(
755
- "Save As PDF",
756
- f,
757
- 'sonogram-speaker-time-'+currPlainName+'.pdf',
758
- key='download-pdf6',
759
- )
760
- with open('ascn_bar.svg') as f:
761
- col6_2.download_button(
762
- "Save As SVG",
763
- f,
764
- 'sonogram-speaker-time-'+currPlainName+'.svg',
765
- key='download-svg6',
766
- )
 
 
767
  st.plotly_chart(fig2_la, use_container_width=True)
768
 
769
  except ValueError:
 
533
  col1_1, col1_2 = st.columns(2)
534
  fig1.write_image("ascn_pie1.pdf")
535
  fig1.write_image("ascn_pie1.svg")
536
+ with col1_1:
537
+ with open('ascn_pie1.pdf') as f:
538
+ st.download_button(
539
+ "Save As PDF",
540
+ f,
541
+ 'sonogram-voice-category-'+currPlainName+'.pdf',
542
+ key='download-pdf1',
543
+ )
544
+ with col1_2:
545
+ with open('ascn_pie1.svg') as f:
546
+ st.download_button(
547
+ "Save As SVG",
548
+ f,
549
+ 'sonogram-voice-category-'+currPlainName+'.svg',
550
+ key='download-svg1',
551
+ )
552
  st.plotly_chart(fig1, use_container_width=True)
553
 
554
  with pie2:
 
571
  col2_1, col2_2 = st.columns(2)
572
  fig2.write_image("ascn_pie2.pdf")
573
  fig2.write_image("ascn_pie2.svg")
574
+ with col2_1:
575
+ with open('ascn_pie2.pdf') as f:
576
+ st.download_button(
577
+ "Save As PDF",
578
+ f,
579
+ 'sonogram-speaker-percent-'+currPlainName+'.pdf',
580
+ key='download-pdf2',
581
+ )
582
+ with col2_2:
583
+ with open('ascn_pie2.svg') as f:
584
+ st.download_button(
585
+ "Save As SVG",
586
+ f,
587
+ 'sonogram-speaker-percent-'+currPlainName+'.svg',
588
+ key='download-svg2',
589
+ )
590
  st.plotly_chart(fig2, use_container_width=True)
591
 
592
  with sunburst1:
 
619
  col3_1, col3_2 = st.columns(2)
620
  fig3_1.write_image("ascn_sunburst.pdf")
621
  fig3_1.write_image("ascn_sunburst.svg")
622
+ with col3_1:
623
+ with open('ascn_sunburst.pdf') as f:
624
+ st.download_button(
625
+ "Save As PDF",
626
+ f,
627
+ 'sonogram-speaker-categories-'+currPlainName+'.pdf',
628
+ key='download-pdf3',
629
+ )
630
+ with col3_2:
631
+ with open('ascn_sunburst.svg') as f:
632
+ st.download_button(
633
+ "Save As SVG",
634
+ f,
635
+ 'sonogram-speaker-categories-'+currPlainName+'.svg',
636
+ key='download-svg3',
637
+ )
638
  st.plotly_chart(fig3_1, use_container_width=True)
639
 
640
  with treemap1:
 
667
  col4_1, col4_2 = st.columns(2)
668
  fig3.write_image("ascn_treemap.pdf")
669
  fig3.write_image("ascn_treemap.svg")
670
+ with col4_1:
671
+ with open('ascn_treemap.pdf') as f:
672
+ st.download_button(
673
+ "Save As PDF",
674
+ f,
675
+ 'sonogram-treemap-'+currPlainName+'.pdf',
676
+ key='download-pdf4',
677
+ )
678
+ with col4_2:
679
+ with open('ascn_treemap.svg') as f:
680
+ st.download_button(
681
+ "Save As SVG",
682
+ f,
683
+ 'sonogram-treemap-'+currPlainName+'.svg',
684
+ key='download-svg4',
685
+ )
686
  st.plotly_chart(fig3, use_container_width=True)
687
 
688
  # generate plotting window
 
717
  col5_1, col5_2 = st.columns(2)
718
  fig_la.write_image("ascn_timeline.pdf")
719
  fig_la.write_image("ascn_timeline.svg")
720
+ with col5_1:
721
+ with open('ascn_timeline.pdf') as f:
722
+ st.download_button(
723
+ "Save As PDF",
724
+ f,
725
+ 'sonogram-timeline-'+currPlainName+'.pdf',
726
+ key='download-pdf5',
727
+ )
728
+ with col5_2:
729
+ with open('ascn_timeline.svg') as f:
730
+ st.download_button(
731
+ "Save As SVG",
732
+ f,
733
+ 'sonogram-timeline-'+currPlainName+'.svg',
734
+ key='download-svg5',
735
+ )
736
  st.plotly_chart(fig_la, use_container_width=True)
737
 
738
  with bar1:
 
760
  col6_1, col6_2 = st.columns(2)
761
  fig_la.write_image("ascn_bar.pdf")
762
  fig_la.write_image("ascn_bar.svg")
763
+ with col6_1:
764
+ with open('ascn_bar.pdf') as f:
765
+ st.download_button(
766
+ "Save As PDF",
767
+ f,
768
+ 'sonogram-speaker-time-'+currPlainName+'.pdf',
769
+ key='download-pdf6',
770
+ )
771
+ with col6_2:
772
+ with open('ascn_bar.svg') as f:
773
+ st.download_button(
774
+ "Save As SVG",
775
+ f,
776
+ 'sonogram-speaker-time-'+currPlainName+'.svg',
777
+ key='download-svg6',
778
+ )
779
  st.plotly_chart(fig2_la, use_container_width=True)
780
 
781
  except ValueError: