juancopi81 commited on
Commit
80f9ee2
1 Parent(s): eb3a234

Rollback to MT3 and adding gradio box

Browse files
Files changed (1) hide show
  1. app.py +33 -30
app.py CHANGED
@@ -25,7 +25,7 @@ os.putenv("QT_QPA_PLATFORM", "offscreen")
25
  os.putenv("XDG_RUNTIME_DIR", environment.Environment().getRootTempDir())
26
 
27
  # Start inference model
28
- inference_model = InferenceModel("/home/user/app/checkpoints/ismir2021/", "ismir2021")
29
  current_model = "ismir2021"
30
 
31
  def change_model(model):
@@ -93,35 +93,38 @@ with demo:
93
  + "</h1>")
94
  gr.Markdown(description)
95
  with gr.Box():
96
- model_label = """
97
- What kind of model you want to use?
98
- The ismir2021 model transcribes piano only, with note velocities.
99
- The mt3 model transcribes multiple simultaneous instruments, but without velocities.
100
- """
101
- model = gr.Radio(
102
- ["mt3", "ismir2021"],
103
- label=model_label,
104
- value="ismir2021"
105
- )
106
- model.change(fn=change_model, inputs=model, outputs=[])
107
-
108
- with gr.Row():
109
- link = gr.Textbox(label="YouTube Link")
110
- with gr.Row():
111
- preview_btn = gr.Button("Preview")
112
- with gr.Row().style(mobile_collapse=False, equal_height=True):
113
- title = gr.Label(label="Video Title", placeholder="Title")
114
- img = gr.Image(label="Thumbnail")
115
- with gr.Row():
116
- yt_audio = gr.Audio()
117
- yt_audio_path = gr.Textbox(visible=False)
118
-
119
- preview_btn.click(fn=populate_metadata,
120
- inputs=[link],
121
- outputs=[img, title, yt_audio, yt_audio_path])
122
-
123
- with gr.Row():
124
- btn = gr.Button("Transcribe music")
 
 
 
125
 
126
  with gr.Row():
127
  midi_file = gr.File()
 
25
  os.putenv("XDG_RUNTIME_DIR", environment.Environment().getRootTempDir())
26
 
27
  # Start inference model
28
+ inference_model = InferenceModel("/home/user/app/checkpoints/mt3/", "mt3")
29
  current_model = "ismir2021"
30
 
31
  def change_model(model):
 
93
  + "</h1>")
94
  gr.Markdown(description)
95
  with gr.Box():
96
+ with gr.Box():
97
+ model_label = """
98
+ What kind of model you want to use?
99
+ The ismir2021 model transcribes piano only, with note velocities.
100
+ The mt3 model transcribes multiple simultaneous instruments, but without velocities.
101
+ """
102
+ model = gr.Radio(
103
+ ["mt3", "ismir2021"],
104
+ label=model_label,
105
+ value="mt3"
106
+ )
107
+ model.change(fn=change_model, inputs=model, outputs=[])
108
+
109
+ with gr.Row():
110
+ link = gr.Textbox(label="YouTube Link")
111
+ with gr.Row():
112
+ preview_btn = gr.Button("Preview")
113
+
114
+ with gr.Box():
115
+ with gr.Row().style(mobile_collapse=False, equal_height=True):
116
+ title = gr.Label(label="Video Title", placeholder="Title")
117
+ img = gr.Image(label="Thumbnail")
118
+ with gr.Row():
119
+ yt_audio = gr.Audio()
120
+ yt_audio_path = gr.Textbox(visible=False)
121
+
122
+ preview_btn.click(fn=populate_metadata,
123
+ inputs=[link],
124
+ outputs=[img, title, yt_audio, yt_audio_path])
125
+
126
+ with gr.Row():
127
+ btn = gr.Button("Transcribe music")
128
 
129
  with gr.Row():
130
  midi_file = gr.File()