import gradio as gr import os img_to_text = gr.Blocks.load(name="spaces/pharma/CLIP-Interrogator") text_to_music = gr.Interface.load("spaces/fffiloni/text-2-music") def get_prompts(uploaded_image): print("calling Clip interrogator ...") prompt = img_to_text(uploaded_image, fn_index=1)[0] print(f"""——— Got prompt result: {prompt} ——————— """) music_result = get_music(prompt) return music_result def get_music(prompt): print("calling now mubert ....") result = text_to_music(prompt, fn_index=0) print(result) return result with gr.Blocks() as demo: gr.HTML("""
Sends an image in to CLIP Interrogator to generate a text prompt which is then run through Mubert text-to-music to generate music from the input image!