Delete streamlit.py
Browse files- streamlit.py +0 -33
streamlit.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from collections import Counter
|
| 3 |
-
import streamlit as st
|
| 4 |
-
import pandas as pd
|
| 5 |
-
|
| 6 |
-
# Streamlit app title
|
| 7 |
-
# st.title('Tag Frequency Table')
|
| 8 |
-
|
| 9 |
-
# File uploader to select folder
|
| 10 |
-
folder_path = "/home/caimera-prod/Paid-data"
|
| 11 |
-
|
| 12 |
-
if folder_path:
|
| 13 |
-
# Initialize a Counter to count tag frequency
|
| 14 |
-
tag_counter = Counter()
|
| 15 |
-
|
| 16 |
-
# Iterate through each .txt file in the folder
|
| 17 |
-
for file_name in os.listdir(folder_path):
|
| 18 |
-
if file_name.endswith('.txt'):
|
| 19 |
-
file_path = os.path.join(folder_path, file_name)
|
| 20 |
-
with open(file_path, 'r') as file:
|
| 21 |
-
tags = file.read().strip().split(',')
|
| 22 |
-
# Clean and count each tag
|
| 23 |
-
tags = [tag.strip().lower() for tag in tags]
|
| 24 |
-
tag_counter.update(tags)
|
| 25 |
-
|
| 26 |
-
# Convert the Counter to a DataFrame for better display
|
| 27 |
-
tag_data = pd.DataFrame(tag_counter.items(), columns=['Tag', 'Count'])
|
| 28 |
-
tag_data = tag_data.sort_values(by='Count', ascending=False).reset_index(drop=True)
|
| 29 |
-
|
| 30 |
-
# Display the DataFrame as a table in Streamlit
|
| 31 |
-
st.subheader('Tag Frequency Table')
|
| 32 |
-
st.table(tag_data)
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|