Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
|
|
|
4 |
from spectro import wav_bytes_from_spectrogram_image
|
5 |
|
6 |
from diffusers import StableDiffusionPipeline
|
@@ -38,7 +39,12 @@ def classic(prompt, negative_prompt, duration):
|
|
38 |
def style_transfer(prompt, negative_prompt, audio_input):
|
39 |
spec = spectro_from_wav(audio_input)
|
40 |
print(spec)
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
wav = wav_bytes_from_spectrogram_image(new_spectro[0])
|
43 |
with open("output.wav", "wb") as f:
|
44 |
f.write(wav[0].getbuffer())
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
|
4 |
+
from PIL import Image
|
5 |
from spectro import wav_bytes_from_spectrogram_image
|
6 |
|
7 |
from diffusers import StableDiffusionPipeline
|
|
|
39 |
def style_transfer(prompt, negative_prompt, audio_input):
|
40 |
spec = spectro_from_wav(audio_input)
|
41 |
print(spec)
|
42 |
+
# Open the image
|
43 |
+
im = Image.open('image.png')
|
44 |
+
|
45 |
+
# Convert the image to a NumPy array
|
46 |
+
image = np.array(im)
|
47 |
+
new_spectro = pipe2(prompt=prompt, image=image, strength=0.5, guidance_scale=7).images
|
48 |
wav = wav_bytes_from_spectrogram_image(new_spectro[0])
|
49 |
with open("output.wav", "wb") as f:
|
50 |
f.write(wav[0].getbuffer())
|