Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -711,15 +711,14 @@ def show_topics_section():
|
|
| 711 |
if st.button("π Refresh Files", key="refresh_topics"):
|
| 712 |
st.rerun()
|
| 713 |
|
| 714 |
-
# Get HTML files from all directories
|
| 715 |
-
|
| 716 |
-
|
| 717 |
-
|
| 718 |
-
|
| 719 |
-
hierarchy_files = list_files_in_directory("visualizations/interactives/hierarchies", ["html"])
|
| 720 |
|
| 721 |
# Combine all files for categorization fallback
|
| 722 |
-
all_html_files =
|
| 723 |
|
| 724 |
if not all_html_files:
|
| 725 |
st.info(
|
|
@@ -755,9 +754,9 @@ def show_topics_section():
|
|
| 755 |
|
| 756 |
# Determine correct path based on file source
|
| 757 |
if selected_file in idm_files:
|
| 758 |
-
file_path = os.path.join("visualizations/
|
| 759 |
else:
|
| 760 |
-
file_path = os.path.join("visualizations
|
| 761 |
|
| 762 |
render_html_visualization(file_path, "")
|
| 763 |
else:
|
|
@@ -783,9 +782,9 @@ def show_topics_section():
|
|
| 783 |
|
| 784 |
# Determine correct path based on file source
|
| 785 |
if selected_file in heatmap_files:
|
| 786 |
-
file_path = os.path.join("visualizations/
|
| 787 |
else:
|
| 788 |
-
file_path = os.path.join("visualizations
|
| 789 |
|
| 790 |
render_html_visualization(file_path, "")
|
| 791 |
else:
|
|
@@ -812,9 +811,9 @@ def show_topics_section():
|
|
| 812 |
|
| 813 |
# Determine correct path based on file source
|
| 814 |
if selected_file in barchart_files:
|
| 815 |
-
file_path = os.path.join("visualizations/
|
| 816 |
else:
|
| 817 |
-
file_path = os.path.join("visualizations
|
| 818 |
|
| 819 |
render_html_visualization(file_path, "")
|
| 820 |
else:
|
|
@@ -840,9 +839,9 @@ def show_topics_section():
|
|
| 840 |
|
| 841 |
# Determine correct path based on file source
|
| 842 |
if selected_file in hierarchy_files:
|
| 843 |
-
file_path = os.path.join("visualizations/
|
| 844 |
else:
|
| 845 |
-
file_path = os.path.join("visualizations
|
| 846 |
|
| 847 |
render_html_visualization(file_path, "")
|
| 848 |
else:
|
|
@@ -872,7 +871,7 @@ def show_sentiments_section():
|
|
| 872 |
|
| 873 |
# Get PNG files from sentiment distribution directory
|
| 874 |
png_files = list_files_in_directory(
|
| 875 |
-
"visualizations/sentiment insights/
|
| 876 |
["png", "jpg", "jpeg"])
|
| 877 |
|
| 878 |
if png_files:
|
|
@@ -881,7 +880,7 @@ def show_sentiments_section():
|
|
| 881 |
format_func=prettify_filename,
|
| 882 |
key="distribution_select")
|
| 883 |
file_path = os.path.join(
|
| 884 |
-
"visualizations/sentiment insights/
|
| 885 |
selected_file)
|
| 886 |
render_image_visualization(file_path, "")
|
| 887 |
else:
|
|
@@ -897,7 +896,7 @@ def show_sentiments_section():
|
|
| 897 |
|
| 898 |
# Get image files from sentiment probability histograms directory
|
| 899 |
hist_files = list_files_in_directory(
|
| 900 |
-
"visualizations/sentiment insights/
|
| 901 |
["png", "jpg", "jpeg"])
|
| 902 |
|
| 903 |
if hist_files:
|
|
@@ -906,7 +905,7 @@ def show_sentiments_section():
|
|
| 906 |
format_func=prettify_filename,
|
| 907 |
key="histograms_select")
|
| 908 |
file_path = os.path.join(
|
| 909 |
-
"visualizations/sentiment insights/
|
| 910 |
selected_file)
|
| 911 |
render_image_visualization(file_path, "")
|
| 912 |
else:
|
|
@@ -923,7 +922,7 @@ def show_sentiments_section():
|
|
| 923 |
|
| 924 |
# Get image files from sentiment probability violins directory
|
| 925 |
violin_files = list_files_in_directory(
|
| 926 |
-
"visualizations/sentiment insights/
|
| 927 |
["png", "jpg", "jpeg"])
|
| 928 |
|
| 929 |
if violin_files:
|
|
@@ -932,7 +931,7 @@ def show_sentiments_section():
|
|
| 932 |
format_func=prettify_filename,
|
| 933 |
key="violins_select")
|
| 934 |
file_path = os.path.join(
|
| 935 |
-
"visualizations/sentiment insights/
|
| 936 |
selected_file)
|
| 937 |
render_image_visualization(file_path, "")
|
| 938 |
else:
|
|
|
|
| 711 |
if st.button("π Refresh Files", key="refresh_topics"):
|
| 712 |
st.rerun()
|
| 713 |
|
| 714 |
+
# Get HTML files from all directories
|
| 715 |
+
idm_files = list_files_in_directory("visualizations/IDM", ["html"])
|
| 716 |
+
heatmap_files = list_files_in_directory("visualizations/heatmaps", ["html"])
|
| 717 |
+
barchart_files = list_files_in_directory("visualizations/barcharts", ["html"])
|
| 718 |
+
hierarchy_files = list_files_in_directory("visualizations/hierarchies", ["html"])
|
|
|
|
| 719 |
|
| 720 |
# Combine all files for categorization fallback
|
| 721 |
+
all_html_files = idm_files + heatmap_files + barchart_files + hierarchy_files
|
| 722 |
|
| 723 |
if not all_html_files:
|
| 724 |
st.info(
|
|
|
|
| 754 |
|
| 755 |
# Determine correct path based on file source
|
| 756 |
if selected_file in idm_files:
|
| 757 |
+
file_path = os.path.join("visualizations/IDM", selected_file)
|
| 758 |
else:
|
| 759 |
+
file_path = os.path.join("visualizations", selected_file)
|
| 760 |
|
| 761 |
render_html_visualization(file_path, "")
|
| 762 |
else:
|
|
|
|
| 782 |
|
| 783 |
# Determine correct path based on file source
|
| 784 |
if selected_file in heatmap_files:
|
| 785 |
+
file_path = os.path.join("visualizations/heatmaps", selected_file)
|
| 786 |
else:
|
| 787 |
+
file_path = os.path.join("visualizations", selected_file)
|
| 788 |
|
| 789 |
render_html_visualization(file_path, "")
|
| 790 |
else:
|
|
|
|
| 811 |
|
| 812 |
# Determine correct path based on file source
|
| 813 |
if selected_file in barchart_files:
|
| 814 |
+
file_path = os.path.join("visualizations/barcharts", selected_file)
|
| 815 |
else:
|
| 816 |
+
file_path = os.path.join("visualizations", selected_file)
|
| 817 |
|
| 818 |
render_html_visualization(file_path, "")
|
| 819 |
else:
|
|
|
|
| 839 |
|
| 840 |
# Determine correct path based on file source
|
| 841 |
if selected_file in hierarchy_files:
|
| 842 |
+
file_path = os.path.join("visualizations/hierarchies", selected_file)
|
| 843 |
else:
|
| 844 |
+
file_path = os.path.join("visualizations", selected_file)
|
| 845 |
|
| 846 |
render_html_visualization(file_path, "")
|
| 847 |
else:
|
|
|
|
| 871 |
|
| 872 |
# Get PNG files from sentiment distribution directory
|
| 873 |
png_files = list_files_in_directory(
|
| 874 |
+
"visualizations/sentiment insights/sentiment distribution",
|
| 875 |
["png", "jpg", "jpeg"])
|
| 876 |
|
| 877 |
if png_files:
|
|
|
|
| 880 |
format_func=prettify_filename,
|
| 881 |
key="distribution_select")
|
| 882 |
file_path = os.path.join(
|
| 883 |
+
"visualizations/sentiment insights/sentiment distribution",
|
| 884 |
selected_file)
|
| 885 |
render_image_visualization(file_path, "")
|
| 886 |
else:
|
|
|
|
| 896 |
|
| 897 |
# Get image files from sentiment probability histograms directory
|
| 898 |
hist_files = list_files_in_directory(
|
| 899 |
+
"visualizations/sentiment insights/sentiment probability histograms",
|
| 900 |
["png", "jpg", "jpeg"])
|
| 901 |
|
| 902 |
if hist_files:
|
|
|
|
| 905 |
format_func=prettify_filename,
|
| 906 |
key="histograms_select")
|
| 907 |
file_path = os.path.join(
|
| 908 |
+
"visualizations/sentiment insights/sentiment probability histograms",
|
| 909 |
selected_file)
|
| 910 |
render_image_visualization(file_path, "")
|
| 911 |
else:
|
|
|
|
| 922 |
|
| 923 |
# Get image files from sentiment probability violins directory
|
| 924 |
violin_files = list_files_in_directory(
|
| 925 |
+
"visualizations/sentiment insights/sentiment probability violins",
|
| 926 |
["png", "jpg", "jpeg"])
|
| 927 |
|
| 928 |
if violin_files:
|
|
|
|
| 931 |
format_func=prettify_filename,
|
| 932 |
key="violins_select")
|
| 933 |
file_path = os.path.join(
|
| 934 |
+
"visualizations/sentiment insights/sentiment probability violins",
|
| 935 |
selected_file)
|
| 936 |
render_image_visualization(file_path, "")
|
| 937 |
else:
|