Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,8 @@ import glob
|
|
16 |
import gradio as gr
|
17 |
from gradio_log import Log
|
18 |
|
19 |
-
|
|
|
20 |
|
21 |
# @title Load Checkpoint
|
22 |
model_name = 'YPTF.MoE+Multi (noPS)' # @param ["YMT3+", "YPTF+Single (noPS)", "YPTF+Multi (PS)", "YPTF.MoE+Multi (noPS)", "YPTF.MoE+Multi (PS)"]
|
@@ -74,7 +75,7 @@ def prepare_media(source_path_or_url: os.PathLike,
|
|
74 |
os.remove(mp4_file)
|
75 |
except Exception as e:
|
76 |
try:
|
77 |
-
with open(
|
78 |
# Try alternative
|
79 |
print(f"Failed with PyTube, error: {e}. Trying yt-dlp...")
|
80 |
audio_file = './downloaded/yt_audio'
|
@@ -91,8 +92,8 @@ def prepare_media(source_path_or_url: os.PathLike,
|
|
91 |
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
92 |
|
93 |
for line in iter(process.stdout.readline, ''):
|
94 |
-
|
95 |
-
|
96 |
process.stdout.close()
|
97 |
process.wait()
|
98 |
|
@@ -172,11 +173,14 @@ css = """
|
|
172 |
50% {background-position: 100% 50%;}
|
173 |
100% {background-position: 0% 50%;}
|
174 |
}
|
|
|
|
|
|
|
|
|
175 |
"""
|
176 |
|
177 |
with gr.Blocks(theme=theme, css=css) as demo:
|
178 |
-
|
179 |
-
Log(log_file, dark=True, xterm_font_size=12)
|
180 |
|
181 |
with gr.Row():
|
182 |
with gr.Column(scale=10):
|
@@ -250,5 +254,8 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
250 |
transcribe_video_button.click(process_video, inputs=youtube_url, outputs=output_tab2)
|
251 |
# Play
|
252 |
play_video_button.click(play_video, inputs=youtube_url, outputs=youtube_player)
|
|
|
|
|
|
|
253 |
|
254 |
demo.launch(debug=True)
|
|
|
16 |
import gradio as gr
|
17 |
from gradio_log import Log
|
18 |
|
19 |
+
# gradio_log
|
20 |
+
log_file = 'amt/log.txt'
|
21 |
|
22 |
# @title Load Checkpoint
|
23 |
model_name = 'YPTF.MoE+Multi (noPS)' # @param ["YMT3+", "YPTF+Single (noPS)", "YPTF+Multi (PS)", "YPTF.MoE+Multi (noPS)", "YPTF.MoE+Multi (PS)"]
|
|
|
75 |
os.remove(mp4_file)
|
76 |
except Exception as e:
|
77 |
try:
|
78 |
+
with open(log_file, 'w') as lf:
|
79 |
# Try alternative
|
80 |
print(f"Failed with PyTube, error: {e}. Trying yt-dlp...")
|
81 |
audio_file = './downloaded/yt_audio'
|
|
|
92 |
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
|
93 |
|
94 |
for line in iter(process.stdout.readline, ''):
|
95 |
+
lf.write(line)
|
96 |
+
lf.flush()
|
97 |
process.stdout.close()
|
98 |
process.wait()
|
99 |
|
|
|
173 |
50% {background-position: 100% 50%;}
|
174 |
100% {background-position: 0% 50%;}
|
175 |
}
|
176 |
+
|
177 |
+
#mylog {min-height: 200px; max-height: 200px}
|
178 |
+
|
179 |
+
|
180 |
"""
|
181 |
|
182 |
with gr.Blocks(theme=theme, css=css) as demo:
|
183 |
+
|
|
|
184 |
|
185 |
with gr.Row():
|
186 |
with gr.Column(scale=10):
|
|
|
254 |
transcribe_video_button.click(process_video, inputs=youtube_url, outputs=output_tab2)
|
255 |
# Play
|
256 |
play_video_button.click(play_video, inputs=youtube_url, outputs=youtube_player)
|
257 |
+
with gr.Column(scale=1):
|
258 |
+
# Logger
|
259 |
+
Log(log_file, dark=True, xterm_font_size=12, elem_id='mylog1') # gradio-log
|
260 |
|
261 |
demo.launch(debug=True)
|