pentarosarium commited on
Commit
2417593
·
1 Parent(s): fff10f8

try minimal interface

Browse files
Files changed (1) hide show
  1. app.py +9 -58
app.py CHANGED
@@ -903,70 +903,21 @@ def process_and_download(file_bytes, control=None):
903
 
904
  # Update the interface creation to pass the control object
905
  def create_interface():
906
- control = ProcessControl()
907
-
908
- with gr.Blocks(
909
- theme=gr.themes.Soft(),
910
- title="AI News Analysis"
911
- ) as app:
912
- gr.Markdown("# AI-анализ мониторинга новостей v.2.24a + extn")
913
-
914
- with gr.Row():
915
- file_input = gr.File(
916
- label="Загрузите Excel файл",
917
- file_types=[".xlsx"],
918
- type="binary" # Changed for Gradio 5.x
919
- )
920
-
921
- with gr.Row():
922
- analyze_btn = gr.Button("▶️ Начать анализ", variant="primary")
923
- stop_btn = gr.Button("⏹️ Остановить", variant="stop")
924
-
925
- with gr.Row():
926
- progress = gr.Textbox(
927
- label="Статус обработки",
928
- value="Ожидание файла...",
929
- interactive=False
930
- )
931
-
932
- with gr.Row():
933
- status_box = gr.Textbox(
934
- label="Статус дедупликации",
935
- value="",
936
- interactive=False
937
- )
938
-
939
- with gr.Row():
940
- stats = gr.Dataframe(
941
- label="Результаты анализа",
942
- interactive=False,
943
- wrap=True
944
- )
945
-
946
- with gr.Row():
947
- sentiment_plot = gr.Plot(label="Распределение тональности")
948
- events_plot = gr.Plot(label="Распределение событий")
949
-
950
- with gr.Row():
951
- file_output = gr.File(label="Скачать результаты")
952
-
953
- def stop_processing():
954
- control.request_stop()
955
- return "Остановка обработки..."
956
 
957
- stop_btn.click(fn=stop_processing, outputs=[progress])
 
 
958
 
959
- analyze_btn.click(
960
- fn=lambda x: process_and_download(x, control),
961
  inputs=[file_input],
962
- outputs=[stats, sentiment_plot, events_plot, file_output, progress, status_box]
963
  )
964
 
965
  return app
966
 
967
  if __name__ == "__main__":
968
  app = create_interface()
969
- app.launch(
970
- server_name="0.0.0.0",
971
- server_port=7860
972
- )
 
903
 
904
  # Update the interface creation to pass the control object
905
  def create_interface():
906
+ with gr.Blocks() as app:
907
+ gr.Markdown("# Test Interface")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
908
 
909
+ file_input = gr.File(label="Upload File")
910
+ btn = gr.Button("Process")
911
+ output = gr.Textbox(label="Output")
912
 
913
+ btn.click(
914
+ fn=lambda x: "File uploaded successfully!" if x else "No file",
915
  inputs=[file_input],
916
+ outputs=[output]
917
  )
918
 
919
  return app
920
 
921
  if __name__ == "__main__":
922
  app = create_interface()
923
+ app.launch()