Spaces:
Runtime error
Runtime error
marcelomoreno26
commited on
Commit
•
6cfa228
1
Parent(s):
9d54e27
Update app.py
Browse files
app.py
CHANGED
@@ -7,12 +7,16 @@ import pandas as pd
|
|
7 |
|
8 |
def main():
|
9 |
st.title("WhatsApp Analysis Tool")
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# File uploader
|
12 |
-
uploaded_file = st.file_uploader("Choose a file (.
|
13 |
if uploaded_file is not None:
|
14 |
file_type = detect_file_type(uploaded_file.name)
|
15 |
-
if file_type
|
16 |
# Process the file
|
17 |
data = preprocess_whatsapp_messages(uploaded_file, file_type)
|
18 |
if data.empty:
|
@@ -26,6 +30,12 @@ def main():
|
|
26 |
text_for_analysis = get_dated_input(data, selected_date)
|
27 |
with st.expander("Show/Hide Original Conversation"):
|
28 |
st.markdown(f"```\n{text_for_analysis}\n```", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
# Load models
|
31 |
tokenizer_sentiment, model_sentiment = load_sentiment_analyzer()
|
|
|
7 |
|
8 |
def main():
|
9 |
st.title("WhatsApp Analysis Tool")
|
10 |
+
st.markdown("This app summarizes Whatsapp chats and provides named entity recognition as well as sentiment analysis for the conversation")
|
11 |
+
st.markdown("**NOTE**: *This app can only receive chats downloaded from IOS as the downloaded chat format is different than from Android.*")
|
12 |
+
st.markdown("Download your whatsapp chat by going to Settings > Chats > Export Chat and there select the chat you want to summarize (download 'Without Media').")
|
13 |
+
|
14 |
|
15 |
# File uploader
|
16 |
+
uploaded_file = st.file_uploader("Choose a file (.zip)", type=['zip'])
|
17 |
if uploaded_file is not None:
|
18 |
file_type = detect_file_type(uploaded_file.name)
|
19 |
+
if file_type == "zip":
|
20 |
# Process the file
|
21 |
data = preprocess_whatsapp_messages(uploaded_file, file_type)
|
22 |
if data.empty:
|
|
|
30 |
text_for_analysis = get_dated_input(data, selected_date)
|
31 |
with st.expander("Show/Hide Original Conversation"):
|
32 |
st.markdown(f"```\n{text_for_analysis}\n```", unsafe_allow_html=True)
|
33 |
+
process = st.button('Process')
|
34 |
+
if process:
|
35 |
+
# Load models
|
36 |
+
tokenizer_sentiment, model_sentiment = load_sentiment_analyzer()
|
37 |
+
tokenizer_summary, model_summary = load_summarizer()
|
38 |
+
pipe_ner = load_NER()
|
39 |
|
40 |
# Load models
|
41 |
tokenizer_sentiment, model_sentiment = load_sentiment_analyzer()
|