|
import sys |
|
import os |
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'amt/src'))) |
|
|
|
|
|
import glob |
|
import gradio as gr |
|
|
|
from gradio_helper import * |
|
|
|
AUDIO_EXAMPLES = glob.glob('/content/examples/*.*', recursive=True) |
|
YOUTUBE_EXAMPLES = ["https://www.youtube.com/watch?v=vMboypSkj3c"] |
|
|
|
theme = 'gradio/dracula_revamped' |
|
with gr.Blocks(theme=theme) as demo: |
|
|
|
with gr.Row(): |
|
with gr.Column(scale=10): |
|
gr.Markdown( |
|
""" |
|
# YourMT3+: Bridging the Gap in Multi-instrument Music Transcription with Advanced Model Architectures and Cross-dataset Stem Augmentation |
|
""") |
|
|
|
with gr.Group(): |
|
with gr.Tab("Upload audio"): |
|
|
|
audio_input = gr.Audio(label="Record Audio", type="filepath", |
|
show_share_button=True, show_download_button=True) |
|
|
|
gr.Examples(examples=AUDIO_EXAMPLES, inputs=audio_input) |
|
|
|
transcribe_audio_button = gr.Button("Transcribe", variant="primary") |
|
|
|
output_tab1 = gr.HTML() |
|
|
|
|
|
transcribe_audio_button.click(process_audio, inputs=audio_input, outputs=output_tab1) |
|
|
|
with gr.Tab("From YouTube"): |
|
with gr.Row(): |
|
|
|
youtube_url = gr.Textbox(label="YouTube Link URL", |
|
placeholder="https://youtu.be/...") |
|
|
|
youtube_player = gr.HTML(render=True) |
|
with gr.Row(): |
|
|
|
play_video_button = gr.Button("Play", variant="primary") |
|
|
|
transcribe_video_button = gr.Button("Transcribe", variant="primary") |
|
|
|
output_tab2 = gr.HTML(render=True) |
|
|
|
transcribe_video_button.click(process_video, inputs=youtube_url, outputs=output_tab2) |
|
|
|
play_video_button.click(play_video, inputs=youtube_url, outputs=youtube_player) |
|
|
|
|
|
gr.Examples(examples=YOUTUBE_EXAMPLES, inputs=youtube_url) |
|
|
|
demo.launch(debug=True) |
|
|