Spaces:
Build error
Build error
juancopi81
commited on
Commit
•
8eb2669
1
Parent(s):
058f5c3
Change from_wav to from_file
Browse files
app.py
CHANGED
@@ -20,10 +20,11 @@ current_model = "mt3"
|
|
20 |
|
21 |
def change_model(model):
|
22 |
global current_model
|
|
|
23 |
if model == current_model:
|
24 |
return
|
25 |
global inference_model
|
26 |
-
inference_model = InferenceModel(
|
27 |
current_model = model
|
28 |
print("Inferece model", inference_model)
|
29 |
|
@@ -37,11 +38,12 @@ def get_audio(url):
|
|
37 |
os.rename(out_file, new_file)
|
38 |
a = new_file
|
39 |
print("file a is:", a)
|
40 |
-
wav_to_cut = AudioSegment.
|
41 |
# pydub does things in milliseconds
|
42 |
ten_seconds = 10 * 1000
|
43 |
first_10_seconds = wav_to_cut[:ten_seconds]
|
44 |
os.remove(new_file)
|
|
|
45 |
return first_10_seconds
|
46 |
|
47 |
# Credits https://huggingface.co/spaces/jeffistyping/Youtube-Whisperer
|
@@ -66,7 +68,7 @@ title = "Transcribe music from YouTube videos using Transformers."
|
|
66 |
description = """
|
67 |
Gradio demo for Music Transcription with Transformers. Read more in the links below.
|
68 |
"""
|
69 |
-
article = "<p style='text-align: center'><a href='https://
|
70 |
|
71 |
# Create a block object
|
72 |
demo = gr.Blocks()
|
|
|
20 |
|
21 |
def change_model(model):
|
22 |
global current_model
|
23 |
+
checkpoint_path = f"/content/checkpoints/{model}/"
|
24 |
if model == current_model:
|
25 |
return
|
26 |
global inference_model
|
27 |
+
inference_model = InferenceModel(checkpoint_path, model)
|
28 |
current_model = model
|
29 |
print("Inferece model", inference_model)
|
30 |
|
|
|
38 |
os.rename(out_file, new_file)
|
39 |
a = new_file
|
40 |
print("file a is:", a)
|
41 |
+
wav_to_cut = AudioSegment.from_file(a)
|
42 |
# pydub does things in milliseconds
|
43 |
ten_seconds = 10 * 1000
|
44 |
first_10_seconds = wav_to_cut[:ten_seconds]
|
45 |
os.remove(new_file)
|
46 |
+
os.remove(a)
|
47 |
return first_10_seconds
|
48 |
|
49 |
# Credits https://huggingface.co/spaces/jeffistyping/Youtube-Whisperer
|
|
|
68 |
description = """
|
69 |
Gradio demo for Music Transcription with Transformers. Read more in the links below.
|
70 |
"""
|
71 |
+
article = "<p style='text-align: center'><a href='https://magenta.tensorflow.org/transcription-with-transformers' target='_blank'>Blog: Music Transcription with Transformers</a> | <a href='https://github.com/magenta/mt3' target='_blank'>Github Repo</a></p>"
|
72 |
|
73 |
# Create a block object
|
74 |
demo = gr.Blocks()
|