Emil25 commited on
Commit
cf33f7d
1 Parent(s): f8ee789

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -81,8 +81,8 @@ def analyze_emotions_in_comments(df: pd.DataFrame) -> tuple:
81
  model = load_model()
82
  selected_columns = ['text', 'author', 'published_at']
83
  df = df[selected_columns]
84
- res_list = []
85
- res_list = model(df['text'].to_list())
86
  full_df = pd.concat([pd.DataFrame(res_list), df], axis=1)
87
  return (full_df, len(res_list))
88
 
@@ -114,7 +114,7 @@ def visualize_data(df: pd.DataFrame):
114
  Visualizes the data from the input DataFrame and returns a matplotlib figure object.
115
  Args: df (DataFrame): The input DataFrame containing the data to be visualized.
116
  Returns: fig: A matplotlib figure object
117
- """
118
  data = df['label'].value_counts()
119
  fig, ax = plt.subplots()
120
  plt.title("Эмоциональная окраска комментариев на YouTube")
@@ -147,8 +147,8 @@ if st.session_state.start:
147
  st.markdown('***')
148
 
149
  # Выводим heatmap комментариев по часам и датам
150
- st.pyplot(plot_heatmap_from_dataframe(full_df))
151
  st.markdown('***')
152
 
153
- # Выводим круговую диаграмму
154
  st.pyplot(visualize_data(full_df))
 
81
  model = load_model()
82
  selected_columns = ['text', 'author', 'published_at']
83
  df = df[selected_columns]
84
+ res_list = []
85
+ res_list = model(df['text'].to_list())
86
  full_df = pd.concat([pd.DataFrame(res_list), df], axis=1)
87
  return (full_df, len(res_list))
88
 
 
114
  Visualizes the data from the input DataFrame and returns a matplotlib figure object.
115
  Args: df (DataFrame): The input DataFrame containing the data to be visualized.
116
  Returns: fig: A matplotlib figure object
117
+ """
118
  data = df['label'].value_counts()
119
  fig, ax = plt.subplots()
120
  plt.title("Эмоциональная окраска комментариев на YouTube")
 
147
  st.markdown('***')
148
 
149
  # Выводим heatmap комментариев по часам и датам
150
+ st.pyplot(plot_heatmap_from_dataframe(full_df))
151
  st.markdown('***')
152
 
153
+ # Выводим круговую диаграмму
154
  st.pyplot(visualize_data(full_df))