Update app.py
Browse files
app.py
CHANGED
@@ -216,6 +216,15 @@ def infer_inp(prompt, audio_path, spec_with_mask, progress=gr.Progress(track_tqd
|
|
216 |
|
217 |
return "output.wav"
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
def load_spec_for_manual_masking(audio_path):
|
220 |
# Loading
|
221 |
audio, sampling_rate = load_wav(audio_path)
|
@@ -228,7 +237,16 @@ def load_spec_for_manual_masking(audio_path):
|
|
228 |
|
229 |
input_spec_image_path = "input_spectrogram.png"
|
230 |
raw_image.save(input_spec_image_path)
|
231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
|
233 |
|
234 |
css="""
|
|
|
216 |
|
217 |
return "output.wav"
|
218 |
|
219 |
+
def create_transparent_layer(image_path):
|
220 |
+
"""Creates a transparent PNG with the same size as the background image."""
|
221 |
+
background = Image.open(image_path)
|
222 |
+
transparent_layer = Image.new("RGBA", background.size, (0, 0, 0, 0))
|
223 |
+
|
224 |
+
layer_path = "layer_one.png"
|
225 |
+
transparent_layer.save(layer_path)
|
226 |
+
return layer_path
|
227 |
+
|
228 |
def load_spec_for_manual_masking(audio_path):
|
229 |
# Loading
|
230 |
audio, sampling_rate = load_wav(audio_path)
|
|
|
237 |
|
238 |
input_spec_image_path = "input_spectrogram.png"
|
239 |
raw_image.save(input_spec_image_path)
|
240 |
+
|
241 |
+
# Create transparent layer
|
242 |
+
layer_one_path = create_transparent_layer(input_spec_image_path)
|
243 |
+
|
244 |
+
# Return as EditorValue
|
245 |
+
return {
|
246 |
+
"background": input_spec_image_path,
|
247 |
+
"layers": [layer_one_path],
|
248 |
+
"composite": None
|
249 |
+
}
|
250 |
|
251 |
|
252 |
css="""
|