Spaces:
Configuration error
Configuration error
Commit
·
c10597c
1
Parent(s):
ac6cb16
Update app
Browse files
app.py
CHANGED
|
@@ -626,20 +626,20 @@ def sync_correct_video(video_path, frames, wav_file, offset, result_folder, samp
|
|
| 626 |
return video_output
|
| 627 |
|
| 628 |
class Logger:
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
|
| 644 |
|
| 645 |
def process_video(video_path, num_avg_frames):
|
|
@@ -777,14 +777,14 @@ def process_video(video_path, num_avg_frames):
|
|
| 777 |
return f"Error: {str(e)}", None
|
| 778 |
|
| 779 |
def read_logs():
|
| 780 |
-
|
| 781 |
-
|
| 782 |
-
|
| 783 |
|
| 784 |
|
| 785 |
if __name__ == "__main__":
|
| 786 |
|
| 787 |
-
|
| 788 |
|
| 789 |
|
| 790 |
# Define the custom HTML for the header
|
|
@@ -928,8 +928,8 @@ if __name__ == "__main__":
|
|
| 928 |
cache_examples=False,
|
| 929 |
)
|
| 930 |
|
| 931 |
-
|
| 932 |
-
|
| 933 |
|
| 934 |
# Launch the interface
|
| 935 |
demo.launch(allowed_paths=["."], show_error=True)
|
|
|
|
| 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):
|
|
|
|
| 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
|
|
|
|
| 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)
|