sindhuhegde commited on
Commit
ac6cb16
·
verified ·
1 Parent(s): f1664aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py CHANGED
@@ -625,6 +625,23 @@ def sync_correct_video(video_path, frames, wav_file, offset, result_folder, samp
625
 
626
  return video_output
627
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
628
  def process_video(video_path, num_avg_frames):
629
  try:
630
  # Extract the video filename
@@ -759,10 +776,17 @@ def process_video(video_path, num_avg_frames):
759
  except Exception as e:
760
  return f"Error: {str(e)}", None
761
 
 
 
 
 
762
 
763
 
764
  if __name__ == "__main__":
765
 
 
 
 
766
  # Define the custom HTML for the header
767
  custom_css = """
768
  <style>
@@ -904,5 +928,8 @@ if __name__ == "__main__":
904
  cache_examples=False,
905
  )
906
 
 
 
 
907
  # Launch the interface
908
  demo.launch(allowed_paths=["."], show_error=True)
 
625
 
626
  return video_output
627
 
628
+ class Logger:
629
+ def __init__(self, filename):
630
+ self.terminal = sys.stdout
631
+ self.log = open(filename, "w")
632
+
633
+ def write(self, message):
634
+ self.terminal.write(message)
635
+ self.log.write(message)
636
+
637
+ def flush(self):
638
+ self.terminal.flush()
639
+ self.log.flush()
640
+
641
+ def isatty(self):
642
+ return False
643
+
644
+
645
  def process_video(video_path, num_avg_frames):
646
  try:
647
  # Extract the video filename
 
776
  except Exception as e:
777
  return f"Error: {str(e)}", None
778
 
779
+ def read_logs():
780
+ sys.stdout.flush()
781
+ with open("output.log", "r") as f:
782
+ return f.read()
783
 
784
 
785
  if __name__ == "__main__":
786
 
787
+ sys.stdout = Logger("output.log")
788
+
789
+
790
  # Define the custom HTML for the header
791
  custom_css = """
792
  <style>
 
928
  cache_examples=False,
929
  )
930
 
931
+ logs = gr.Textbox()
932
+ demo.load(read_logs, None, logs, every=1)
933
+
934
  # Launch the interface
935
  demo.launch(allowed_paths=["."], show_error=True)