LAPINILLA commited on
Commit
8e579dd
1 Parent(s): 1b94b76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -312,8 +312,16 @@ def process_inputs(task_type, topic, integration_period, num_results):
312
  df = update_dataframe_with_results(results)
313
  archivo1 = main(df, google_search_query)
314
  resumen_text = resumen(archivo1)
 
 
 
 
 
 
 
315
 
316
- return archivo1,resumen_text
 
317
 
318
  # Create the Gradio blocks interface
319
  with gr.Blocks() as app:
@@ -327,13 +335,15 @@ with gr.Blocks() as app:
327
  with gr.Column():
328
  output_text_intermedio = gr.Textbox(label="Resultados Intermedios", interactive=True, lines=10)
329
  output_text_final = gr.Textbox(label="Resultados Compilados", interactive=True, lines=10)
330
-
 
 
331
 
332
  # Define what happens when you click the Submit button
333
  submit_button.click(
334
  fn=process_inputs,
335
  inputs=[task_type, topic, integration_period, num_results],
336
- outputs=[output_text_intermedio,output_text_final]
337
  )
338
 
339
  if __name__ == "__main__":
 
312
  df = update_dataframe_with_results(results)
313
  archivo1 = main(df, google_search_query)
314
  resumen_text = resumen(archivo1)
315
+ # Save outputs to temporary files
316
+ path_intermediate = "intermediate_results.txt"
317
+ path_final = "final_results.txt"
318
+ with open(path_intermediate, "w") as f:
319
+ f.write(archivo1)
320
+ with open(path_final, "w") as f:
321
+ f.write(resumen_text)
322
 
323
+ # Return both the text for display and the file paths for downloading
324
+ return archivo1, resumen_text, path_intermediate, path_final
325
 
326
  # Create the Gradio blocks interface
327
  with gr.Blocks() as app:
 
335
  with gr.Column():
336
  output_text_intermedio = gr.Textbox(label="Resultados Intermedios", interactive=True, lines=10)
337
  output_text_final = gr.Textbox(label="Resultados Compilados", interactive=True, lines=10)
338
+ download_intermediate = gr.File(label="Download Intermediate Results")
339
+ download_final = gr.File(label="Download Final Results")
340
+
341
 
342
  # Define what happens when you click the Submit button
343
  submit_button.click(
344
  fn=process_inputs,
345
  inputs=[task_type, topic, integration_period, num_results],
346
+ outputs=[output_text_intermedio, output_text_final, download_intermediate, download_final]
347
  )
348
 
349
  if __name__ == "__main__":