pentarosarium commited on
Commit
234ea97
·
1 Parent(s): 7b14387
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -216,6 +216,8 @@ def process_file(uploaded_file, model_choice, translation_method=None):
216
  try:
217
  df = pd.read_excel(uploaded_file, sheet_name='Публикации')
218
  llm = init_langchain_llm(model_choice)
 
 
219
  translator = TranslationSystem(batch_size=5)
220
 
221
  # Initialize all required columns first
@@ -515,7 +517,7 @@ def init_langchain_llm(model_choice):
515
  temperature=0.0
516
  )
517
 
518
- elif model_choice == "Local-BLOOMZ": # Added new option
519
  return FallbackLLMSystem()
520
 
521
  else: # Qwen API
@@ -723,7 +725,7 @@ def create_output_file(df, uploaded_file, llm):
723
  return output
724
  def main():
725
  with st.sidebar:
726
- st.title("::: AI-анализ мониторинга новостей (v.3.46):::")
727
  st.subheader("по материалам СКАН-ИНТЕРФАКС ")
728
 
729
 
@@ -781,6 +783,7 @@ def main():
781
  uploaded_file = st.sidebar.file_uploader("Выбирайте Excel-файл", type="xlsx", key="unique_file_uploader")
782
 
783
  if uploaded_file is not None and st.session_state.processed_df is None:
 
784
  try:
785
  st.session_state.processed_df = process_file(
786
  uploaded_file,
@@ -827,8 +830,14 @@ def main():
827
 
828
 
829
 
830
- output = create_output_file(st.session_state.processed_df, uploaded_file, llm)
831
 
 
 
 
 
 
 
 
832
  end_time = time.time()
833
  elapsed_time = end_time - start_time
834
  formatted_time = format_elapsed_time(elapsed_time)
 
216
  try:
217
  df = pd.read_excel(uploaded_file, sheet_name='Публикации')
218
  llm = init_langchain_llm(model_choice)
219
+ # Add fallback initialization here
220
+ fallback_llm = FallbackLLMSystem() if model_choice != "Local-MT5" else llm
221
  translator = TranslationSystem(batch_size=5)
222
 
223
  # Initialize all required columns first
 
517
  temperature=0.0
518
  )
519
 
520
+ elif model_choice == "Local-MT5": # Added new option
521
  return FallbackLLMSystem()
522
 
523
  else: # Qwen API
 
725
  return output
726
  def main():
727
  with st.sidebar:
728
+ st.title("::: AI-анализ мониторинга новостей (v.3.47):::")
729
  st.subheader("по материалам СКАН-ИНТЕРФАКС ")
730
 
731
 
 
783
  uploaded_file = st.sidebar.file_uploader("Выбирайте Excel-файл", type="xlsx", key="unique_file_uploader")
784
 
785
  if uploaded_file is not None and st.session_state.processed_df is None:
786
+ start_time = time.time()
787
  try:
788
  st.session_state.processed_df = process_file(
789
  uploaded_file,
 
830
 
831
 
832
 
 
833
 
834
+ output = create_output_file(
835
+ st.session_state.processed_df,
836
+ uploaded_file,
837
+ init_langchain_llm(model_choice) # Initialize new LLM instance
838
+ )
839
+
840
+
841
  end_time = time.time()
842
  elapsed_time = end_time - start_time
843
  formatted_time = format_elapsed_time(elapsed_time)