pentarosarium commited on
Commit
44a66e5
·
1 Parent(s): 094bdb2
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -648,7 +648,7 @@ def create_interface():
648
  # Create state for file data
649
  current_file = gr.State(None)
650
 
651
- gr.Markdown("# AI-анализ мониторинга новостей v.1.46")
652
 
653
  with gr.Row():
654
  file_input = gr.File(
@@ -702,7 +702,7 @@ def create_interface():
702
  with gr.Row():
703
  file_output = gr.File(
704
  label="Скачать результаты",
705
- visible=False,
706
  interactive=True
707
  )
708
 
@@ -748,11 +748,15 @@ def create_interface():
748
  output_bytes_io = create_output_file(result_df, file_obj)
749
  if output_bytes_io:
750
  fig_sentiment, fig_events = create_visualizations(result_df)
 
 
 
 
751
  return (
752
  result_df,
753
  fig_sentiment,
754
  fig_events,
755
- ("partial_results.xlsx", output_bytes_io.getvalue()),
756
  f"Обработка остановлена. Обработано {len(processed_rows)}/{total} строк",
757
  dedup_message
758
  )
@@ -794,11 +798,15 @@ def create_interface():
794
  fig_sentiment, fig_events = create_visualizations(result_df)
795
 
796
  if output_bytes_io:
 
 
 
 
797
  return (
798
  result_df,
799
  fig_sentiment,
800
  fig_events,
801
- ("результаты_анализа.xlsx", output_bytes_io.getvalue()),
802
  "Обработка завершена!",
803
  dedup_message
804
  )
 
648
  # Create state for file data
649
  current_file = gr.State(None)
650
 
651
+ gr.Markdown("# AI-анализ мониторинга новостей v.1.47!")
652
 
653
  with gr.Row():
654
  file_input = gr.File(
 
702
  with gr.Row():
703
  file_output = gr.File(
704
  label="Скачать результаты",
705
+ visible=True,
706
  interactive=True
707
  )
708
 
 
748
  output_bytes_io = create_output_file(result_df, file_obj)
749
  if output_bytes_io:
750
  fig_sentiment, fig_events = create_visualizations(result_df)
751
+ # Create temporary file
752
+ temp_file = "partial_results.xlsx"
753
+ with open(temp_file, "wb") as f:
754
+ f.write(output_bytes_io.getvalue())
755
  return (
756
  result_df,
757
  fig_sentiment,
758
  fig_events,
759
+ temp_file, # Return path to temporary file
760
  f"Обработка остановлена. Обработано {len(processed_rows)}/{total} строк",
761
  dedup_message
762
  )
 
798
  fig_sentiment, fig_events = create_visualizations(result_df)
799
 
800
  if output_bytes_io:
801
+ # Create temporary file
802
+ temp_file = "results.xlsx"
803
+ with open(temp_file, "wb") as f:
804
+ f.write(output_bytes_io.getvalue())
805
  return (
806
  result_df,
807
  fig_sentiment,
808
  fig_events,
809
+ temp_file, # Return path to temporary file
810
  "Обработка завершена!",
811
  dedup_message
812
  )