pentarosarium commited on
Commit
34a740d
·
1 Parent(s): 9e97a7c

progress more 47

Browse files
Files changed (2) hide show
  1. app.py +20 -2
  2. requirements.txt +1 -1
app.py CHANGED
@@ -14,7 +14,7 @@ from openpyxl import load_workbook
14
  from openpyxl import Workbook
15
  from openpyxl.utils.dataframe import dataframe_to_rows
16
  from sentiment_decorators import sentiment_analysis_decorator
17
- from langchain.llms import HuggingFacePipeline
18
  from langchain.prompts import PromptTemplate
19
  from langchain.chains import LLMChain
20
 
@@ -64,12 +64,30 @@ def process_file_with_llm(df, llm):
64
  df['LLM_Impact'] = ''
65
  df['LLM_Reasoning'] = ''
66
 
 
 
 
 
 
 
 
 
67
  for index, row in df.iterrows():
68
  if any(row[model] in ['Negative', 'Positive'] for model in ['FinBERT', 'RoBERTa', 'FinBERT-Tone']):
69
  impact, reasoning = estimate_impact(llm, row['Translated']) # Use translated text
70
  df.at[index, 'LLM_Impact'] = impact
71
  df.at[index, 'LLM_Reasoning'] = reasoning
72
 
 
 
 
 
 
 
 
 
 
 
73
  return df
74
 
75
  def create_output_file_with_llm(df, uploaded_file, analysis_df):
@@ -372,7 +390,7 @@ def create_output_file(df, uploaded_file, analysis_df):
372
  return output
373
 
374
  def main():
375
- st.title("... приступим к анализу... версия 46")
376
 
377
  # Initialize session state
378
  if 'processed_df' not in st.session_state:
 
14
  from openpyxl import Workbook
15
  from openpyxl.utils.dataframe import dataframe_to_rows
16
  from sentiment_decorators import sentiment_analysis_decorator
17
+ from langchain_community.llms import HuggingFacePipeline
18
  from langchain.prompts import PromptTemplate
19
  from langchain.chains import LLMChain
20
 
 
64
  df['LLM_Impact'] = ''
65
  df['LLM_Reasoning'] = ''
66
 
67
+ # Create a progress bar
68
+ progress_bar = st.progress(0)
69
+ status_text = st.empty()
70
+
71
+ total_rows = len(df)
72
+ rows_to_process = df[df[['FinBERT', 'RoBERTa', 'FinBERT-Tone']].isin(['Negative', 'Positive']).any(axis=1)]
73
+
74
+
75
  for index, row in df.iterrows():
76
  if any(row[model] in ['Negative', 'Positive'] for model in ['FinBERT', 'RoBERTa', 'FinBERT-Tone']):
77
  impact, reasoning = estimate_impact(llm, row['Translated']) # Use translated text
78
  df.at[index, 'LLM_Impact'] = impact
79
  df.at[index, 'LLM_Reasoning'] = reasoning
80
 
81
+ # Update progress
82
+ progress = (index + 1) / total_rows
83
+ progress_bar.progress(progress)
84
+ status_text.text(f"Проанализировано {index + 1} из {total_rows} новостей")
85
+
86
+ # Clear the progress bar and status text
87
+ progress_bar.empty()
88
+ status_text.empty()
89
+
90
+
91
  return df
92
 
93
  def create_output_file_with_llm(df, uploaded_file, analysis_df):
 
390
  return output
391
 
392
  def main():
393
+ st.title("... приступим к анализу... версия 47")
394
 
395
  # Initialize session state
396
  if 'processed_df' not in st.session_state:
requirements.txt CHANGED
@@ -11,4 +11,4 @@ rapidfuzz
11
  matplotlib
12
  sacremoses
13
  langchain
14
- langchain_community
 
11
  matplotlib
12
  sacremoses
13
  langchain
14
+ langchain-community