juancopi81 commited on
Commit
8a2ae69
1 Parent(s): 92dbcc7

First working version

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -34,8 +34,9 @@ title = """
34
  def get_bg_image(prompt):
35
  images = pipe(prompt)
36
  print("Image generated!")
37
- image_output = images.images[0] if not images.nsfw_content_detected[0] else Image.open("nsfw_placeholder.jpg")
38
- return image_output
 
39
 
40
  def get_music(prompt):
41
  spec = pipe2(prompt, height=512, width=512).images[0]
@@ -49,7 +50,9 @@ def infer(prompt):
49
  image = get_bg_image(prompt)
50
  audio = get_music(prompt)
51
  return (
52
- gr.make_waveform("output.wav", bg_image=image, bars_color=random.choice(COLORS)),
 
 
53
  )
54
 
55
  css = """
@@ -84,7 +87,7 @@ with gr.Blocks(css=css) as demo:
84
  elem_id="prompt-in",
85
  label="Enter your music prompt")
86
  with gr.Row(elem_id="btn-container"):
87
- send_btn = gr.Button(value="Send", elem_id="submit-btn")
88
  send_btn.click(infer,
89
  inputs=[prompt_input],
90
  outputs=[gr.Video()])
 
34
  def get_bg_image(prompt):
35
  images = pipe(prompt)
36
  print("Image generated!")
37
+ image_output = images.images[0]
38
+ image_output.save("img.png")
39
+ return "img.png"
40
 
41
  def get_music(prompt):
42
  spec = pipe2(prompt, height=512, width=512).images[0]
 
50
  image = get_bg_image(prompt)
51
  audio = get_music(prompt)
52
  return (
53
+ gr.make_waveform(audio,
54
+ bg_image=image,
55
+ bars_color=random.choice(COLORS))
56
  )
57
 
58
  css = """
 
87
  elem_id="prompt-in",
88
  label="Enter your music prompt")
89
  with gr.Row(elem_id="btn-container"):
90
+ send_btn = gr.Button(value="Send", elem_id="submit-btn")
91
  send_btn.click(infer,
92
  inputs=[prompt_input],
93
  outputs=[gr.Video()])