susnato commited on
Commit
cef9668
1 Parent(s): ba11378

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -26
app.py CHANGED
@@ -59,7 +59,7 @@ def inference(file_uploaded, composer):
59
 
60
 
61
  # Thanks a lot to "https://huggingface.co/Taithrah" for this theme.
62
- # taken from https://huggingface.co/spaces/Taithrah/Minimal
63
  block = gr.Blocks(theme="Taithrah/Minimal")
64
 
65
  with block:
@@ -86,34 +86,30 @@ with block:
86
  """
87
  )
88
  with gr.Group():
89
- with gr.Box():
90
- with gr.Row().style(mobile_collapse=False, equal_height=True):
91
- file_uploaded = gr.Audio(label="Upload an audio", type="filepath")
92
 
93
- with gr.Column():
94
- with gr.Row():
95
- yt_link = gr.Textbox(label="Enter YouTube link of the Video")
96
- yt_btn = gr.Button("Get Audio from the YT link(Press this before pressing Generate)")
97
-
98
-
99
- yt_audio_path = gr.Audio(label="Audio Extracted from the YouTube Video", interactive=False)
100
-
101
- yt_btn.click(get_audio_from_yt_video, inputs=[yt_link], outputs=[yt_audio_path, file_uploaded])
102
 
103
- with gr.Box():
104
- with gr.Row().style(mobile_collapse=False, equal_height=True):
105
- composer = gr.Dropdown(label="Arranger", choices=composers, value="composer1")
106
-
107
- with gr.Row().style(mobile_collapse=False, equal_height=True):
108
- btn = gr.Button("Generate")
 
109
 
110
- with gr.Box():
111
- with gr.Row().style(mobile_collapse=False, equal_height=True):
112
- wav_output2 = gr.File(label="Download the Generated MIDI (.wav)")
113
- wav_output1 = gr.Audio(label="Listen to the Generated MIDI")
114
- midi_output = gr.File(label="Download the Generated MIDI (.mid)")
115
- btn.click(inference, inputs=[file_uploaded, composer], outputs=[wav_output1, wav_output2, midi_output])
116
 
 
117
  gr.Examples([
118
  ["./examples/custom_song.mp3", "composer1"],
119
  ["./examples/BornThisWay.mp3", "composer1"],
@@ -127,7 +123,20 @@ with block:
127
  gr.HTML(
128
  """
129
  <div class="footer">
130
- <p><a href="http://sweetcocoa.github.io/pop2piano_samples" style="text-decoration: underline;" target="_blank">Project Page</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  </p>
132
  </div>
133
  """
 
59
 
60
 
61
  # Thanks a lot to "https://huggingface.co/Taithrah" for this theme.
62
+ # taken from https://huggingface.co/spaces/NoCrypt/miku
63
  block = gr.Blocks(theme="Taithrah/Minimal")
64
 
65
  with block:
 
86
  """
87
  )
88
  with gr.Group():
89
+ with gr.Row().style(mobile_collapse=False, equal_height=True):
90
+ file_uploaded = gr.Audio(label="Upload an audio", type="filepath")
 
91
 
92
+ with gr.Column():
93
+ with gr.Row():
94
+ yt_link = gr.Textbox(label="Enter YouTube link of the Video", autofocus=True)
95
+ yt_btn = gr.Button("Get Audio from the YT link(Press this before pressing Generate)")
 
 
 
 
 
96
 
97
+ yt_audio_path = gr.Audio(label="Audio Extracted from the YouTube Video", interactive=False)
98
+ yt_btn.click(get_audio_from_yt_video, inputs=[yt_link], outputs=[yt_audio_path, file_uploaded])
99
+
100
+ with gr.Group():
101
+ with gr.Column():
102
+ composer = gr.Dropdown(label="Arranger", choices=composers, value="composer1")
103
+ btn = gr.Button("Generate")
104
 
105
+ with gr.Group():
106
+ with gr.Row().style(mobile_collapse=False, equal_height=True):
107
+ wav_output2 = gr.File(label="Download the Generated MIDI (.wav)")
108
+ wav_output1 = gr.Audio(label="Listen to the Generated MIDI")
109
+ midi_output = gr.File(label="Download the Generated MIDI (.mid)")
110
+ btn.click(inference, inputs=[file_uploaded, composer], outputs=[wav_output1, wav_output2, midi_output])
111
 
112
+ with gr.Group():
113
  gr.Examples([
114
  ["./examples/custom_song.mp3", "composer1"],
115
  ["./examples/BornThisWay.mp3", "composer1"],
 
123
  gr.HTML(
124
  """
125
  <div class="footer">
126
+ <center>The design for this Space is taken from <a href="https://huggingface.co/spaces/NoCrypt/miku"> NoCrypt/miku </a>
127
+ </p>
128
+ </div>
129
+ """
130
+ )
131
+
132
+ gr.HTML(
133
+ """
134
+ <div class="footer">
135
+ <center><p><a href="http://sweetcocoa.github.io/pop2piano_samples" style="text-decoration: underline;" target="_blank">Project Page</a>
136
+ <center><a href="https://huggingface.co/docs/transformers/main/model_doc/pop2piano" style="text-decoration: underline;" target="_blank">HuggingFace Model Card</a>
137
+ <center><a href="http://sweetcocoa.github.io/pop2piano_samples" style="text-decoration: underline;" target="_blank">Github</a>
138
+
139
+
140
  </p>
141
  </div>
142
  """