fffiloni commited on
Commit
85d7512
1 Parent(s): b23c55f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -13,6 +13,16 @@ from scipy.io import wavfile
13
  import torch
14
  import torchaudio
15
 
 
 
 
 
 
 
 
 
 
 
16
  def wav_bytes_from_spectrogram_image(image):
17
  """
18
  Reconstruct a WAV audio clip from a spectrogram image. Also returns the duration in seconds.
@@ -133,4 +143,4 @@ def waveform_from_spectrogram(
133
  return waveform
134
 
135
 
136
- gr.Interface(fn=wav_bytes_from_spectrogram_image, inputs=[gr.Image(source="upload", type="pil")], outputs=[gr.Audio()]).launch()
 
13
  import torch
14
  import torchaudio
15
 
16
+ from diffusers import StableDiffusionPipeline
17
+
18
+ model_id = "riffusion/riffusion-model-v1"
19
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
20
+ pipe = pipe.to("cuda")
21
+
22
+ def get_spectro(prompt):
23
+ image = pipe(prompt).images[0]
24
+ return image
25
+
26
  def wav_bytes_from_spectrogram_image(image):
27
  """
28
  Reconstruct a WAV audio clip from a spectrogram image. Also returns the duration in seconds.
 
143
  return waveform
144
 
145
 
146
+ gr.Interface(fn=get_spectro, inputs=[gr.Textbox()], outputs=[gr.Image()]).launch()