Spaces:
Sleeping
Sleeping
added extra folder organization
Browse files
app.py
CHANGED
|
@@ -736,16 +736,15 @@ def show_topics_section():
|
|
| 736 |
"**Why it matters:** Quickly spot clusters of related themes (for example, 'policy and activism')."
|
| 737 |
)
|
| 738 |
|
| 739 |
-
files
|
| 740 |
-
|
| 741 |
-
files = html_files # Fallback to all files
|
| 742 |
|
| 743 |
-
if
|
| 744 |
selected_file = st.selectbox("Choose visualization:",
|
| 745 |
-
|
| 746 |
format_func=prettify_filename,
|
| 747 |
key="intertopic_select")
|
| 748 |
-
file_path = os.path.join("visualizations/interactives",
|
| 749 |
selected_file)
|
| 750 |
render_html_visualization(file_path, "")
|
| 751 |
else:
|
|
@@ -758,16 +757,15 @@ def show_topics_section():
|
|
| 758 |
st.markdown(
|
| 759 |
"**Why it matters:** Reveals which themes often appear together.")
|
| 760 |
|
| 761 |
-
files
|
| 762 |
-
|
| 763 |
-
files = html_files
|
| 764 |
|
| 765 |
-
if
|
| 766 |
selected_file = st.selectbox("Choose visualization:",
|
| 767 |
-
|
| 768 |
format_func=prettify_filename,
|
| 769 |
key="heatmap_select")
|
| 770 |
-
file_path = os.path.join("visualizations/interactives",
|
| 771 |
selected_file)
|
| 772 |
render_html_visualization(file_path, "")
|
| 773 |
else:
|
|
@@ -781,16 +779,15 @@ def show_topics_section():
|
|
| 781 |
"**Why it matters:** See which conversations dominate the climate anxiety space."
|
| 782 |
)
|
| 783 |
|
| 784 |
-
files
|
| 785 |
-
|
| 786 |
-
files = html_files
|
| 787 |
|
| 788 |
-
if
|
| 789 |
selected_file = st.selectbox("Choose visualization:",
|
| 790 |
-
|
| 791 |
format_func=prettify_filename,
|
| 792 |
key="barchart_select")
|
| 793 |
-
file_path = os.path.join("visualizations/interactives",
|
| 794 |
selected_file)
|
| 795 |
render_html_visualization(file_path, "")
|
| 796 |
else:
|
|
@@ -798,22 +795,20 @@ def show_topics_section():
|
|
| 798 |
|
| 799 |
with hierarchy_tab:
|
| 800 |
st.markdown(
|
| 801 |
-
"**What it shows:**
|
| 802 |
)
|
| 803 |
st.markdown(
|
| 804 |
-
"**Why it matters:**
|
| 805 |
-
)
|
| 806 |
|
| 807 |
-
files
|
| 808 |
-
|
| 809 |
-
files = html_files
|
| 810 |
|
| 811 |
-
if
|
| 812 |
selected_file = st.selectbox("Choose visualization:",
|
| 813 |
-
|
| 814 |
format_func=prettify_filename,
|
| 815 |
key="hierarchy_select")
|
| 816 |
-
file_path = os.path.join("visualizations/interactives",
|
| 817 |
selected_file)
|
| 818 |
render_html_visualization(file_path, "")
|
| 819 |
else:
|
|
@@ -843,7 +838,7 @@ def show_sentiments_section():
|
|
| 843 |
|
| 844 |
# Get PNG files from sentiment distribution directory
|
| 845 |
png_files = list_files_in_directory(
|
| 846 |
-
"visualizations/
|
| 847 |
["png", "jpg", "jpeg"])
|
| 848 |
|
| 849 |
if png_files:
|
|
@@ -852,7 +847,7 @@ def show_sentiments_section():
|
|
| 852 |
format_func=prettify_filename,
|
| 853 |
key="distribution_select")
|
| 854 |
file_path = os.path.join(
|
| 855 |
-
"visualizations/
|
| 856 |
selected_file)
|
| 857 |
render_image_visualization(file_path, "")
|
| 858 |
else:
|
|
@@ -868,7 +863,7 @@ def show_sentiments_section():
|
|
| 868 |
|
| 869 |
# Get image files from sentiment probability histograms directory
|
| 870 |
hist_files = list_files_in_directory(
|
| 871 |
-
"visualizations/
|
| 872 |
["png", "jpg", "jpeg"])
|
| 873 |
|
| 874 |
if hist_files:
|
|
@@ -877,7 +872,7 @@ def show_sentiments_section():
|
|
| 877 |
format_func=prettify_filename,
|
| 878 |
key="histograms_select")
|
| 879 |
file_path = os.path.join(
|
| 880 |
-
"visualizations/
|
| 881 |
selected_file)
|
| 882 |
render_image_visualization(file_path, "")
|
| 883 |
else:
|
|
@@ -894,7 +889,7 @@ def show_sentiments_section():
|
|
| 894 |
|
| 895 |
# Get image files from sentiment probability violins directory
|
| 896 |
violin_files = list_files_in_directory(
|
| 897 |
-
"visualizations/
|
| 898 |
["png", "jpg", "jpeg"])
|
| 899 |
|
| 900 |
if violin_files:
|
|
@@ -903,7 +898,7 @@ def show_sentiments_section():
|
|
| 903 |
format_func=prettify_filename,
|
| 904 |
key="violins_select")
|
| 905 |
file_path = os.path.join(
|
| 906 |
-
"visualizations/
|
| 907 |
selected_file)
|
| 908 |
render_image_visualization(file_path, "")
|
| 909 |
else:
|
|
@@ -1115,4 +1110,4 @@ def show_terms_page():
|
|
| 1115 |
|
| 1116 |
|
| 1117 |
if __name__ == "__main__":
|
| 1118 |
-
main()
|
|
|
|
| 736 |
"**Why it matters:** Quickly spot clusters of related themes (for example, 'policy and activism')."
|
| 737 |
)
|
| 738 |
|
| 739 |
+
# Get HTML files from specific IDM directory
|
| 740 |
+
intertopic_files = list_files_in_directory("visualizations/interactives/IDM", ["html"])
|
|
|
|
| 741 |
|
| 742 |
+
if intertopic_files:
|
| 743 |
selected_file = st.selectbox("Choose visualization:",
|
| 744 |
+
intertopic_files,
|
| 745 |
format_func=prettify_filename,
|
| 746 |
key="intertopic_select")
|
| 747 |
+
file_path = os.path.join("visualizations/interactives/IDM",
|
| 748 |
selected_file)
|
| 749 |
render_html_visualization(file_path, "")
|
| 750 |
else:
|
|
|
|
| 757 |
st.markdown(
|
| 758 |
"**Why it matters:** Reveals which themes often appear together.")
|
| 759 |
|
| 760 |
+
# Get HTML files from specific heatmaps directory
|
| 761 |
+
heatmap_files = list_files_in_directory("visualizations/interactives/heatmaps", ["html"])
|
|
|
|
| 762 |
|
| 763 |
+
if heatmap_files:
|
| 764 |
selected_file = st.selectbox("Choose visualization:",
|
| 765 |
+
heatmap_files,
|
| 766 |
format_func=prettify_filename,
|
| 767 |
key="heatmap_select")
|
| 768 |
+
file_path = os.path.join("visualizations/interactives/heatmaps",
|
| 769 |
selected_file)
|
| 770 |
render_html_visualization(file_path, "")
|
| 771 |
else:
|
|
|
|
| 779 |
"**Why it matters:** See which conversations dominate the climate anxiety space."
|
| 780 |
)
|
| 781 |
|
| 782 |
+
# Get HTML files from specific barcharts directory
|
| 783 |
+
barchart_files = list_files_in_directory("visualizations/interactives/barcharts", ["html"])
|
|
|
|
| 784 |
|
| 785 |
+
if barchart_files:
|
| 786 |
selected_file = st.selectbox("Choose visualization:",
|
| 787 |
+
barchart_files,
|
| 788 |
format_func=prettify_filename,
|
| 789 |
key="barchart_select")
|
| 790 |
+
file_path = os.path.join("visualizations/interactives/barcharts",
|
| 791 |
selected_file)
|
| 792 |
render_html_visualization(file_path, "")
|
| 793 |
else:
|
|
|
|
| 795 |
|
| 796 |
with hierarchy_tab:
|
| 797 |
st.markdown(
|
| 798 |
+
"**What it shows:** Topics arranged like a family tree—broad categories break down into specific sub-themes."
|
| 799 |
)
|
| 800 |
st.markdown(
|
| 801 |
+
"**Why it matters:** Perfect for drilling down from general worry to specific concerns.")
|
|
|
|
| 802 |
|
| 803 |
+
# Get HTML files from specific hierarchies directory
|
| 804 |
+
hierarchy_files = list_files_in_directory("visualizations/interactives/hierarchies", ["html"])
|
|
|
|
| 805 |
|
| 806 |
+
if hierarchy_files:
|
| 807 |
selected_file = st.selectbox("Choose visualization:",
|
| 808 |
+
hierarchy_files,
|
| 809 |
format_func=prettify_filename,
|
| 810 |
key="hierarchy_select")
|
| 811 |
+
file_path = os.path.join("visualizations/interactives/hierarchies",
|
| 812 |
selected_file)
|
| 813 |
render_html_visualization(file_path, "")
|
| 814 |
else:
|
|
|
|
| 838 |
|
| 839 |
# Get PNG files from sentiment distribution directory
|
| 840 |
png_files = list_files_in_directory(
|
| 841 |
+
"visualizations/sentiment insights/sentiment_distribution",
|
| 842 |
["png", "jpg", "jpeg"])
|
| 843 |
|
| 844 |
if png_files:
|
|
|
|
| 847 |
format_func=prettify_filename,
|
| 848 |
key="distribution_select")
|
| 849 |
file_path = os.path.join(
|
| 850 |
+
"visualizations/sentiment insights/sentiment_distribution",
|
| 851 |
selected_file)
|
| 852 |
render_image_visualization(file_path, "")
|
| 853 |
else:
|
|
|
|
| 863 |
|
| 864 |
# Get image files from sentiment probability histograms directory
|
| 865 |
hist_files = list_files_in_directory(
|
| 866 |
+
"visualizations/sentiment insights/sentiment_probability_histograms",
|
| 867 |
["png", "jpg", "jpeg"])
|
| 868 |
|
| 869 |
if hist_files:
|
|
|
|
| 872 |
format_func=prettify_filename,
|
| 873 |
key="histograms_select")
|
| 874 |
file_path = os.path.join(
|
| 875 |
+
"visualizations/sentiment insights/sentiment_probability_histograms",
|
| 876 |
selected_file)
|
| 877 |
render_image_visualization(file_path, "")
|
| 878 |
else:
|
|
|
|
| 889 |
|
| 890 |
# Get image files from sentiment probability violins directory
|
| 891 |
violin_files = list_files_in_directory(
|
| 892 |
+
"visualizations/sentiment insights/sentiment_probability_violins",
|
| 893 |
["png", "jpg", "jpeg"])
|
| 894 |
|
| 895 |
if violin_files:
|
|
|
|
| 898 |
format_func=prettify_filename,
|
| 899 |
key="violins_select")
|
| 900 |
file_path = os.path.join(
|
| 901 |
+
"visualizations/sentiment insights/sentiment_probability_violins",
|
| 902 |
selected_file)
|
| 903 |
render_image_visualization(file_path, "")
|
| 904 |
else:
|
|
|
|
| 1110 |
|
| 1111 |
|
| 1112 |
if __name__ == "__main__":
|
| 1113 |
+
main()
|