juancopi81 commited on
Commit
72b1826
1 Parent(s): 02063a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -3,6 +3,8 @@ import gradio as gr
3
  from tensorflow import keras
4
  from PIL import Image
5
 
 
 
6
  keras.mixed_precision.set_global_policy("float32")
7
  # load keras model
8
  resolution=512
@@ -23,8 +25,11 @@ def generate_images(prompt: str, num_steps: int, unconditional_guidance_scale: i
23
  )
24
 
25
  pil_img = Image.fromarray(img[0])
26
-
27
- return pil_img
 
 
 
28
 
29
 
30
  # pass function, input type for prompt, the output for multiple images
@@ -41,7 +46,7 @@ gr.Interface(
41
  gr.Slider(label='Temperature', value=1, maximum=1.5, minimum=0, step=0.1),
42
  ],
43
  outputs=[
44
- gr.Image(),
45
  ],
46
  examples=[["a $currulao song", 50, 7.5, 1]],
47
  ).queue().launch(debug=True)
 
3
  from tensorflow import keras
4
  from PIL import Image
5
 
6
+ from spectro import wav_bytes_from_spectrogram_image
7
+
8
  keras.mixed_precision.set_global_policy("float32")
9
  # load keras model
10
  resolution=512
 
25
  )
26
 
27
  pil_img = Image.fromarray(img[0])
28
+ wav = wav_bytes_from_spectrogram_image(new_spectro[0])
29
+ with open("output.wav", "wb") as f:
30
+ f.write(wav[0].getbuffer())
31
+ final_video = gr.make_waveform("output.wav", bg_image=pil_img)
32
+ return final_video
33
 
34
 
35
  # pass function, input type for prompt, the output for multiple images
 
46
  gr.Slider(label='Temperature', value=1, maximum=1.5, minimum=0, step=0.1),
47
  ],
48
  outputs=[
49
+ gr.Video(),
50
  ],
51
  examples=[["a $currulao song", 50, 7.5, 1]],
52
  ).queue().launch(debug=True)