File size: 841 Bytes
391222d
e7d2d44
391222d
 
 
 
 
 
fbbc41b
e7d2d44
391222d
1b28bbd
ba26d1c
391222d
 
 
 
0f006b9
ba26d1c
 
 
 
391222d
 
 
 
 
159f2f8
391222d
0f006b9
5300b13
391222d
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
import os

img_to_text = gr.Blocks.load(name="spaces/pharma/CLIP-Interrogator")
text_to_music = gr.Interface.load("spaces/Mubert/Text-to-Music")

def get_prompts(uploaded_image):
  prompt = img_to_text(uploaded_image, fn_index=1)[0]
  print(prompt)
  
  music_result = get_music(prompt)
  
  return music_result

def get_music(prompt):
  email = "[email protected]"
  duration = 30
  result = text_to_music(email, prompt, duration)
  
  output = os.path.join(result)
  print(output)
  return prompt

with gr.Blocks() as demo:
  with gr.Row():
    with gr.Column():
      input_img = gr.Image(type="filepath")
      generate = gr.Button("Generate Music from Image")
    with gr.Column():
      music_output = gr.Textbox(label="Result")
  generate.click(get_prompts, inputs=[input_img], outputs=[music_output])

demo.launch()