aatu18 commited on
Commit
f5e7c06
·
verified ·
1 Parent(s): 11efff9

revert redirecting logs to buffer

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import io
2
  import json
3
  import os
4
  import re
@@ -628,10 +627,6 @@ def format_result_string_multi(result):
628
 
629
  @utilities.timeit
630
  def execute_pipeline(question: str):
631
- # redirect stdout to logs
632
- buffer = io.StringIO()
633
- sys_stdout = sys.stdout
634
- sys.stdout = buffer
635
 
636
  df = pd.DataFrame({"questions": [question]})
637
  print(f"\n\nQuestion received: {question}\n")
@@ -703,14 +698,7 @@ def execute_pipeline(question: str):
703
  result_string = format_error_string()
704
 
705
 
706
- # Restore stdout
707
- sys.stdout = sys_stdout
708
- logs = buffer.getvalue()
709
-
710
- # Format logs for Markdown
711
- logs_string = f"```bash\n{logs}\n```"
712
-
713
- return result_string, logs_string
714
 
715
 
716
  def visible_component(input_text):
@@ -758,14 +746,12 @@ with gr.Blocks(title="GDC QAG MCP server", css="""
758
  _The result of the query will appear here_
759
  """
760
  )
761
-
762
- logs = gr.Markdown()
763
 
764
 
765
  execute_button.click(
766
  fn=execute_pipeline,
767
  inputs=[query_input],
768
- outputs=[output, logs],
769
  )
770
 
771
 
 
 
1
  import json
2
  import os
3
  import re
 
627
 
628
  @utilities.timeit
629
  def execute_pipeline(question: str):
 
 
 
 
630
 
631
  df = pd.DataFrame({"questions": [question]})
632
  print(f"\n\nQuestion received: {question}\n")
 
698
  result_string = format_error_string()
699
 
700
 
701
+ return result_string
 
 
 
 
 
 
 
702
 
703
 
704
  def visible_component(input_text):
 
746
  _The result of the query will appear here_
747
  """
748
  )
 
 
749
 
750
 
751
  execute_button.click(
752
  fn=execute_pipeline,
753
  inputs=[query_input],
754
+ outputs=output,
755
  )
756
 
757